Git 回滚

1、重置当前正在编辑的工作空间到服务器状态(未提交)

git reset --hard HEAD
2、重置当前编辑空间的部分文件到服务器状态(未提交)

git checkout WebReport/通讯录.xls
3、重置提交了但是没有push的commit(已提交)

git relog
找到对应的版本ID

git reset --hard c11ac3a4fc6718890064464cbcab156b05db3195
4、已经commit而且push到服务器, 回滚方法:

git log
git reset --hard c11ac3a4fc6718890064464cbcab156b05db3195
git push origin HEAD --force

 

 

posted @ 2018-01-04 11:54  单先生  阅读(284)  评论(0编辑  收藏  举报