使用 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 一样的事