介绍git原理的不错的文章: git from inside out
- git log —pretty=oneline
- git log -1
- git rev-parse —git-dir #show the .git folder name
- git add . git add filename git add all git add . -A
- git commit -s
- git commit -m “msg”
- git commit —amend # add the current file to the previous change list
- git push
- git bisect 是用二分法协助RD查找是哪笔check-in导致的错误的,请参考
- git diff 文件格式说明,link
- git diff HEAD — readme.txt
- git reset —hard HEAD^ 用remote端最新code盖掉index区域的改动(已经add到index的改动)
- git reset —hard 1094a 指定回到某个版本
- git cherry-pick
- git reflog 查找使用过的git command
Mac01:BlueShell wnnwoo$ git reflog
894474c (HEAD -> master) HEAD@{0}: reset: moving to HEAD^
fcdea80 (origin/master) HEAD@{1}: commit: fix build error
894474c (HEAD -> master) HEAD@{2}: commit: update basic operation
94e2258 HEAD@{3}: commit: Run the scheme testing
f305bac HEAD@{4}: commit: add generics test code
4acfba7 HEAD@{5}: commit: Add error handle - git checkout — readme.txt 丢弃工作区的改动
- git reset HEAD readme.txt 暂存区的修改回退到工作区
- git diff > abc.diff
- git apply abc.diff
control + r # search the history command