Reputation: 306
I have accidently pushed a branch with git push origin HEAD:DEVELOP
and it merged all the commits to develop branch. The branch contained lots of unwanted commits. How to revert this and set develop branch to original state
Upvotes: 0
Views: 104
Reputation: 675
If you know the correct git commit id, to which it should be reverted. You can use the git command
git push --force <remote> <commit-id>:<branch name>
I have used this previously and it works. NOTE: please proceed with caution and make sure commit id you pass is correct.
Reference: https://stackoverflow.com/a/40580976/4556029
Upvotes: 4