1、提交
git commit -m "注释" 文件名

2、查看提交日志


3、回退到某个版本
git reset --hard [索引值]
git reset --hard HEAD~3 -----后退三步

4、删除文件并且找回
1、本地库执行rm命令
rm aaa.txt
2、提交命令
git commit -m "delete aaa.txt" aaa.txt
3、查看log
$ git reflog
7864c76 (HEAD -> master) HEAD@{0}: commit: delete aaa.txt
6db43a7 HEAD@{1}: commit: new add aaa.txt
71663c9 HEAD@{2}: reset: moving to 71663c9
c92fe1c HEAD@{3}: reset: moving to c92fe1c
09db94e HEAD@{4}: reset: moving to 09db94e
c92fe1c HEAD@{5}: commit: four
71663c9 HEAD@{6}: commit: three
09db94e HEAD@{7}: commit: my second commit
85982fe HEAD@{8}: commit (initial): my first commit new file ggod.txt
4、回退版本
$ git reset --hard 6db43a7
HEAD is now at 6db43a7 new add aaa.txt
5、分支
1、查看分支命令
$ git branch -v
* master 6db43a7 new add aaa.txt
2、创建分支
$ git branch dev20200209
3、切换分支
$ git checkout dev20200209
Switched to branch 'dev20200209'
4、合并分支
1、切换到要合并到的分支
$ git checkout master
2、执行merge命令
$ git merge dev20200209
Already up to date.
网友评论