OOZOU
與我們聯繫
返回 TIL 列表
shell

使用 Git 的 aliases 功能

October 13, 2020

Git 允許你透過 config 在內部建立 alias。你的全域 config 應該位於 ~/.gitconfig

[alias]
  aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort
  count = shortlog -sn
  l = log
  co = checkout
  ca = commit -C HEAD --amend
  c  = commit
  cm = commit -m
  a  = add
  s  = status
  b  = branch
  p  = push
  mt = mergetool
  dt = difftool
  o  = origin
  rc = rebase --continue
  rs = rebase --skip
  pd  = !git checkout develop && git pull origin develop && git branch --merged | grep -v '*' | grep -v 'master' | xargs git branch -d && git fetch --prune origin
  pm  = !git checkout master && git pull origin master && git branch --merged | grep -v '*' | grep -v 'develop' | xargs git branch -d && git fetch --prune origin
  pr = pull-request -c -m

大多數都不言自明...

git pd(prune develop)- 切換到 develop、拉取最新變更、刪除 develop 以外所有過時的 branch(也會刪掉 master)

git pm(prune master)- 對 master 做和 prune develop 一樣的事

更多關於 shell 的筆記

shellDecember 8, 2020

在 Bash 和 Zsh 執行無痕/私密指令

只要在指令前面加一個空格,它就不會被存進 ~/.bash\_history。例如 qrencode -o out.png "Some secret text"

shellOctober 22, 2020

用 homebrew 升級 postgres 資料庫

要升級 postgres,可以執行

shellOctober 13, 2020

用 Amazon AWS S3 CLI 複製檔案並設定權限

打開 term(或同類終端機)並貼上以下內容:

有專案構想嗎?

我們很樂意聆聽您正在打造的產品。

開始對話hello@oozou.com
OOZOU Logo

曼谷 · 新加坡 · 香港

X
Facebook
Instagram
LinkedIn

服務

  • Web 開發
  • AI 代理人與生成式 AI
  • 行動應用開發
  • 數據分析與工程
  • UI/UX 與產品設計
  • 數位轉型

公司

  • 關於我們
  • 職涯
  • 部落格
  • 案例研究
  • Today I Learned
  • 聯繫我們

更多

  • 產業
  • 合作夥伴網絡
© 2026 OOZOU. 版權所有。
隱私政策行為準則反賄賂反貪腐政策