git的日常使用

平时使用git进行版本控制,有一些基本的语句进行记录

$ touch README.md
$ git init
$ git add .
$ git commit -m 'init'
$ git remote add origin https://github.com/guanpengchn/Master.git
$ git push -u origin master

查看版本以及版本回退

$ git log
$ git log --pretty=oneline
3628164fb26d48395383f8f31179f24e0882e1e0 append GPL
ea34578d5496d7dd233c827ed32a8cd576c5ee85 add distributed
cb926e7ea50ad11b8f9e909c05226233bf755030 wrote a readme file
$ git reset --hard ea34578
$ git show 3628164
$ git diff

$ git reflog
ea34578 HEAD@{0}: reset: moving to HEAD^
3628164 HEAD@{1}: commit: append GPL
ea34578 HEAD@{2}: commit: add distributed
cb926e7 HEAD@{3}: commit (initial): wrote a readme file
$ git git reset --hard 3628164

你可能感兴趣的:(git的日常使用)