在 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
相关推荐
程序员小崔日记12 小时前
如何将代码轻松上传到 Gitee?Git 使用全攻略!
git·gitee·上传
Bigger1 天前
为什么你的 Git 提交需要签名?—— Git Commit Signing 完全指南
git·开源·github
DianSan_ERP2 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
红豆子不相思2 天前
Tomcat 环境搭建与集群实战
服务器·git·tomcat
杰哥技术分享2 天前
Git 仓库迁移技术文档:从 CODING.net 迁移至腾讯云 CNB
git
梅孔立2 天前
Ansible 100 台服务器一键管控实战 进阶版
服务器·git·ansible
qq_426003963 天前
git切换当前分支到远程分支
git
ON10N3 天前
100% 纯 Vibe Coding,我是怎么用 AI 撸出一个 VS Code 插件的
git·ai编程·visual studio code
Lunar*3 天前
告别臃肿!使用 git-filter-repo 优雅清理 Git 历史记录
git