1. git diff
- 不接参数,顺序展示多个文件的差异内容(和暂存区内容对比);
- 接参数filename,展示指定文件的差异内容(和暂存区内容对比);
- 接参数–cached,暂存区和本地仓库进行对比。
2. git checkout -b [branch_name]
3. git branch -vv
4. git branch -a
5. git branch -D [branch_name]
6. git push origin --delete [branch_name]
7. git fetch origin [branch_name]
8. git merge origin/ [branch_name]
- 拉取远程分支的更新之后,使用merge操作合并到本地。
9. git merge [branch_name]
10. git log
11. git log --color --graph --pretty=’%Cred%h %C(yellow)%ad %C(reset)%cn %C(bold blue)%B %Cgreen%d’ --date=short
12. git config --global alias.lg “log --color --graph --pretty=’%Cred%h %C(yellow)%ad %C(reset)%cn %C(bold blue)%B %Cgreen%d’ --date=short”
13. git config --global --list
14. git config --global --unset alias.lg
15. git cherry-pick [commit_id1] [commit_id2]
16. git rebase [start_id] [end_id] -i --onto [branch_name]
- 对指定commit_id范围内的commit进行合并操作。
17. git reset
18. git reset HEAD
19. git reset --hard [commit_id]
20. git checkout – [filename]
21. git reflog
22. git log --oneline
23. git log origin/[branch_name]
24. git show [commit_id]