简体   繁体   中英

git reset — hard with to previous commit set local and remote repository

I want to do a git reset to a previous commit. I want my local repo to reflect the changes when I go back to the old commit and I want my remote repo to do the same. How do I do this?

  • git reset HEAD~1
  • git stash save 'Save the commit changes just in case'
  • git push origin -f your_branch_name

Check this article out as well https://ncona.com/2011/07/how-to-delete-a-commit-in-git-local-and-remote/

DISCLAIMER: Force push is not at all safe but that is the only way I know to remove commits from remote.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM