git 别名配置

51 阅读1分钟

在使用 git 命令时输入全命令有时很繁琐的,有些命令很长会记不住,配置一些别名方便记忆的同时,也能提高使用命令的效率,有助于我们快速的进行代码管理。

br = branch
brm = branch -m # old -> new
ss = status
co = checkout

plr = pull --rebase
pl = pull
ps = push
pst = push --tags

rb = rebase

cim = commit -m
cia = commit --amend
ci = commit

lgp = log -p
lgs = log --stat

# 以不同的格式输出日志
lgo = log --pretty='oneline' --abbrev-commit # commitId 和 commit信息
lgg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative # 以树形结构展示分支关系、日志信息等
lga = log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

dic = diff --cached
difi = diff --ignore-blank-lines --ignore-all-space --ignore-cr-at-eol
dici = dic --ignore-blank-lines --ignore-all-space --ignore-cr-at-eol

cfg = config --list --global
cfl = config --list --local

# 缓存区 相关命令
st = stash
stl = stash list
stp = stash pop
stc = stash clear
stl-dr = stash list --date=relative # show 具体时间
stl-ds = stash list --date=short # show 简短时间
st-tree = git log --graph --oneline --decorate  $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' ) # 调出误删 暂存 栈数据, 以树形结构方式 展示 log 信息
sta = git stash apply # 取出缓存栈数据( id 或 @{}形式 )
stl-dl = stash list --date=local

# git rebase
rba = rebase --abort
rbc = rebase --continue

# git reset
rs = reset
rsh = reset --hard

# cherry-pick
cp = cherry-pick
cpc = cp --continue
cpa = cp --abort
# 打包
zip = archive --format=zip --o # 分支 标签 版本差异等 打包

# git tag
tgn = tag -n # 列出版本和描述信

# git show
shows = show --stat # 展示文件详情

详细的内容掘主●语雀