在home目录下有个.gitconfig文件,里面有[alias]
段,即是别名配置,我经常把push打成psuh/pus/psh等,所以就使用别名啊,即使错了也不用再重新敲命令了。
最高效的别名当属acp (add commit push),添加对应的别名后,使用命令git acp "提交信息"
即可一个命令代替三个命令,如 git acp "测试一次性git add . && git commit -m "\xxxx\" && git push"
。
附上个人别名列表(不再更新):
[alias]
st = status
p = pull
pl = pull
pul = pull
ps = push
pus = push
psh = push
psuh = push
cl = clone
co = checkout
ci = commit
last = log -1 HEAD
bv = branch -v
ba = branch -a
acp = "!f() { git add . && git commit -m \"$@\" && git push; }; f"
附上完整的.gitconfig
[credential]
helper = store
[alias]
s = status
st = status
stauts = status
p = pull
pl = pull
pll = pull
pu = pull
pul = pull
ps = push
pus = push
psh = push
psuh = push
puhs = push
cl = clone
co = checkout
ci = commit
last = log -1 HEAD
bv = branch -v
ba = branch -a
acp = "!f() { git add . && git commit -m \"$@\" && git push; }; f"
lg = "log --graph --decorate --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
pp = "!pp() { git pull && git push; }; pp"
[http]
version = HTTP/1.1
sslVerify = false
postBuffer = 157286400
[filesystem "Oracle Corporation|1.8.0_121|468992"]
timestampResolution = 1001 microseconds
minRacyThreshold = 0 nanoseconds
[pull]
rebase = true