1. 建立版本库 git initgit
2. 添加当前目录全部的文件到索引 git add .索引
3. 添加指定文件到索引 git add readme.txt源码
4. 提交到本地源码库,并附加提交注释 git commit -m "first commit"it
5. 查看状态 git statustest
6. 查看文件变化 git diff readme.txt可视化
7. 版本回退,回退到上一版本 git reset --hard HEAD^ 回退到上上版本 git reset --hard HEAD^^ 回退到往上100个版本 git reset --hard HEAD~100db
8. 版本还原 git reset --hard 10095adb(commit id)注释
9. 查看记录 git reflogdi
10. 查看分支 git branch文件
11. 建立分支 git branch test(分支名)
12. 切换分支 git checkout test(分支名)
13. 删除分支 git branch -d test(分支名)
14. 查看提交历史 git log
15. 恢复修改前状态 git checkout --readme.txt(文件名)
16. 打开可视化界面 gitk
17. 从远程仓库拉取最新 git pull
18. 将本地代码推到远程仓库 git push