git撤销已经push到远程的commit

在原来的gh-pages更改了主题后, 发现写的index.html不见了,
使用git log查看下, 原来是有新的提交:

commit 2c639a...
Set theme jekyll-theme-cayman and migrate Page Generator content

commit e990a7...
Update README.md

这里使用git reset --hard e990a7回退到e990a7这一次提交,
然后git push origin gh-pages推送, 报错:

git撤销已经push到远程的commit_第1张图片

此时使用git push origin gh-pages --force就可以了.

参考:
http://blog.csdn.net/xs20691718/article/details/51901161

欢迎补充指正!

你可能感兴趣的:(版本控制)