• 列出当前配置: git config --list

  • 列出 repository 配置: git config --local --list

  • 列出全局配置: git config --global --list

  • 设置 git 输出彩色: git config --global color.ui auto

  • 显示与上次提交版本的不同: git diff

  • 提交历史: git log

  • 显示所有提交历史: git log --oneline

  • 列出所有分支: git branch

  • 列出远程分支: git branch -r

  • 切换分支: git checkout <branch>

  • 给当前版本添加 tag: git tag <tag-name>

  • 列出当前配置的远程端: git remote -v

  • 添加远程端: git remote add <remote-name> <url>

  • 下载远程端但不 merge: git fetch <remote>

  • 下载远程端并自动 merge: git pull

  • 删除远程端分支: git push <remote> --delete <branch>

  • 发布标签: git push --tags

  • 回滚到上个 commit: git reset --hard HEAD

  • 回滚到某个版本: git reset --hard <commit>

  • 清除 staged: git reset HEAD