在 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
相关推荐
淘矿人1 天前
从0到1:用Claude启动你的第一个项目
开发语言·人工智能·git·python·github·php·pygame
lpfasd1231 天前
Git/Gitee/GitHub 3 个安全凭证详解
git·gitee·github
李日灐1 天前
< 7 > Linux 开发工具:git 版本控制器 和 cgdb/gdb 调试器
linux·运维·服务器·开发语言·git·调试器·gdb/cgdb
Gust of wind1 天前
idea结合git和Gitee的初步使用
git·gitee·intellij-idea
夜七少eleanor1 天前
【Git】2026全图文详解安装教程
git
海边的Kurisu1 天前
从零开始的Git生活 | 刚实习同学的噩梦 And 参与开源不可缺的一环
git·生活
不老刘1 天前
Git Cherry-Pick:微前端架构下的“精准医疗”与最佳实践
前端·git
爬楼的猪1 天前
Git Folder Dashboard
git
Uncertainty!!1 天前
claude code中添加skills自动生成git commit信息
git·git commit·claude code
FserSuN1 天前
Git Worktree 使用学习
git·学习