git命令设置简写(别名)
前言:有时候在执行git命令比较多的情况下,每次敲git命令比较费时,同时有些命令比如cherry-pick这种比较长时更是费时,所以可以通过设置命令行简写来设置。
修改方法:
- windows下:
打开.gitconfig文件(在git安装目录下的mingw64etc),编辑如下:(最后边追加)
[alias]
ckt = checkout
ci = commit
st = status
pl = pull
ps = push
gdf = gitdiff
l = log
cp = cherry-pick
ca = commit -a
b = branch
- linux下:
任意路径下输入:vim ~/.gitconfig,在后边追加如下内容:
[alias]
ckt = checkout
ci = commit
st = status
pl = pull
ps = push
gdf = gitdiff
l = log
cp = cherry-pick
ca = commit -a
b = branch