不可逆提交
一,reset
1.git log查看提交记录
git log
2.选择某次提交的commit ID,ctrl+c复制提交ID
3.使用git reset –hard 还原到某一次提交
git reset --hard commit ID

二,checkout
1.git checkout commit ID ,这个命令达到的效果和git reset –hard一样都是不可逆提交
git checkout commit ID
可逆提交
一,checkout
1.git checkout 还原某个文件到某次commit

checkout 后再次查看提交记录,上一次的提交并没有被还原掉

git获取指定的历史版本
把项目 clone 到其他文件夹下
git clone git@github.com:skyming/BMAdScrollView.git
然后查看指定历史版本 tree 的 SHA

checkout 即可,哎,程序员,需要什么学什么。。。
git checkout b0362a895d39061c0bc6f05c575af47de1b3f702
然后就顺利切到指定的分支版本了。。。
网友评论