Article Directory
Background For
my needs (hope to flush out subsequent commits)
background I am
careless to modify the code on the main branch, push it up, and pollute the main branch. I hope to roll back the changes after the main branch, including the commit record. , Is to return to the desired version in the remote record and keep it clean.
git push -f can do it, it will flush all commits, if you want to roll back after git push -f: http://blog.sina.com.cn/s/blog_66cd08930102x0ln.html
If you don’t want to flush out all subsequent commits, https://blog.csdn.net/gomeplus/article/details/78241070
For my needs (hope to flush
out the subsequent commit) rollback command:
$ git reset --hard HEAD^ Go back to the previous version
$ git reset --hard HEAD~3 Go back to before the first 3 commits, and so on, go back to before n commits
$ git reset --hard commit_id Go back/into the sha code of the specified commit
Push to remote:
$ git push origin HEAD --force
https://www.cnblogs.com/spring87/p/7867435.html