CyanHall.com 创建于 2020-11-10, 上次更新:2021-04-30。
👉  github shields 如果有用请点赞。
如果想查询 Git 命令每个参数的含义复制粘贴到 explainshell 查询。

1. 提交统计

    git shortlog -sne
  

2. 列出多个分支的提交日志 (感谢 twitter@AntonioAnerao)

    git log --all --graph --decorate --oneline
  

3. 改变默认的编辑器

    git config --global core.editor `which vi`
  

4. 修改上一条提交描述

    git commit --amend
  

5. 设置 Git 对大小写敏感

    git config core.ignorecase false
  

6. 恢复成未修改的状态

    git checkout -- [path/filename]
  

7. 列出所有远程分支

    git remote -v
  

8. 修改远程仓库地址

    git remote set-url origin [repo_url]
  

9. 列出所有分支

    git branch -a
  

10. 改变当前分支

    git checkout [branch_name]
  

11. 合并指定分支

    git merge [branch_name]
  

12. 创建临时的工作空间

    git stash
git stash list
git stash pop
  

13. 切换到某个提交状态

    git reset --hard [commit_hash]
  

14. 使用 Git 子模块

    git submodule add url
git submodule init
git submodule update
  

15. 自动拉取带子模块的 Git 仓库

    git clone --recursive [url]
  

1. 提交统计

    git shortlog -sne
  

3. 改变默认的编辑器

    git config --global core.editor `which vi`
  

5. 设置 Git 对大小写敏感

    git config core.ignorecase false
  

7. 列出所有远程分支

    git remote -v
  

9. 列出所有分支

    git branch -a
  

11. 合并指定分支

    git merge [branch_name]
  

13. 切换到某个提交状态

    git reset --hard [commit_hash]
  

15. 自动拉取带子模块的 Git 仓库

    git clone --recursive [url]
  

2. 列出多个分支的提交日志 (感谢 twitter@AntonioAnerao)

    git log --all --graph --decorate --oneline
  

4. 修改上一条提交描述

    git commit --amend
  

6. 恢复成未修改的状态

    git checkout -- [path/filename]
  

8. 修改远程仓库地址

    git remote set-url origin [repo_url]
  

10. 改变当前分支

    git checkout [branch_name]
  

12. 创建临时的工作空间

    git stash
git stash list
git stash pop
  

14. 使用 Git 子模块

    git submodule add url
git submodule init
git submodule update
  


Maitained by Cyanhall.com, Copy Rights @ CC BY-NC-SA 4.0