0

accidentally I pushed the changes before completely finish it.

now I want to revert the changes.. how can I do that?

  • 1
    i think this can help u https://stackoverflow.com/questions/4114095/how-do-i-revert-a-git-repository-to-a-previous-commit?rq=1 :) – Six Nov 25 '22 at 13:52
  • Does this answer your question? [How do I revert a Git repository to a previous commit?](https://stackoverflow.com/questions/4114095/how-do-i-revert-a-git-repository-to-a-previous-commit) – Vivek Nuna Nov 25 '22 at 14:41

1 Answers1

0

There are quite a few methods in the post that @carolina pointed to.... however, I do not see the simplest 2 if it is a feature branch that no one else is working on:

delete the remote branch

git push some-remote :the-branch # make sure to use the colon

Push a different commit to the branch

git push some-remote -f $( git merge-base HEAD the-upstream-branch ):the-branch

That will push the revision from the upstream branch that the current branch started from.

eftshift0
  • 26,375
  • 3
  • 36
  • 60