在 Git 中配置 Aliases(别名)

在 Git 中配置 Aliases(别名) 是提高开发效率的神器。它不仅能让你少敲键盘,还能把复杂的命令组合成简单易记的短指令。
终端执行:git config --global --edit


下面列出了我个人在使用 Git 时发现的一些提高生产力的别名。你可以直接使用它们,或者根据需要进行修改。

bash 复制代码
[alias]
  co = checkout
  cob = checkout -b
  coo = !git fetch && git checkout
  br = branch
  brd = branch -d
  st = status
  aa = add -A .
  unstage = reset --soft HEAD^
  cm = commit -m
  amend = commit --amend -m
  fix = commit --fixup
  undo = reset HEAD~1
  rv = revert
  cp = cherry-pick
  pu = !git push origin `git branch --show-current`
  fush = push -f
  flush = push --force-with-lease
  mg = merge --no-ff
  rb = rebase
  rbc = rebase --continue
  rba = rebase --abort
  rbs = rebase --skip
  rom = !git fetch && git rebase -i origin/master --autosquash
  save = stash push
  pop = stash pop
  apply = stash apply
  rl = reflog
相关推荐
JackieDYH8 小时前
Git 与 GitHub 新电脑配置指南(从零开始)
git·github·工具·使用教程
Jeanyia18 小时前
GitLab 配套 Git 常用命令
git·gitlab
10mAh21 小时前
【Git】误删分支、reset --hard 后提交丢了怎么办?——reflog、fsck 与安全恢复实战
数据库·git·安全·回归
Lydro1 天前
CentOS 7 安装高版本git
git·centos 7
guwentian1 天前
Git Worktree 实战:用并行多 Agent 把开发提速 N 倍
大数据·git·elasticsearch·wroktree
不吃鱼的羊1 天前
Git识别未修改的文件有修改
git
蓝黑墨水2 天前
一个git问题的处理
git
互联网中的一颗神经元2 天前
21 — 额外命令:同时开两个窗口、自动检查哨
git
_道隐_2 天前
git stash save 和 git stash push有什么区别?
git
_道隐_2 天前
git stash如何pop指定的stash change?
git