0

I accidentally pushed some wrong code to origin/my_branch. My local was up to the same as the origin/my_branch. So after I clicked "revert commit" on the origin/my_branch, my local is one commit ahead of origin/my_branch. Now I want to "unstage" some changes from local/my_branch so I can push the right code to origin/my_branch. I don't know how to do this "unstage" in Sourcetree.

Gene Xu
  • 609
  • 1
  • 8
  • 18
  • Does this answer your question? [How do I undo the most recent local commits in Git?](https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git) – LeGEC Jul 07 '20 at 15:10
  • The action you are looking for is `git reset` Search "how to undo changes in git" on google, I suggested one of the questions on SO as a possible solution. – LeGEC Jul 07 '20 at 15:12
  • No it doesn't. Three differences: 1. I've pushed my wrong codes to the origin, and I've reverted the origin to the stage before my wrong commit. 2. Changes are still in my local, which I want to cherrypick to push again. 3. How to do this in sourcetree instead of in git? – Gene Xu Jul 07 '20 at 15:14
  • I've done revert (reset). What I'm looking for is how to cherrypick my changes (all staged) from my local (1 commit ahead of the origin coz I've reverted my change in origin) and push them to the origin again. – Gene Xu Jul 07 '20 at 15:16
  • you created a new commit locally with revert. No deal: git commit --amend to modify the revert, or git reset. You won't be able to remove the commit from remote without force pushing. – Daemon Painter Jul 07 '20 at 15:21

0 Answers0