0

I just accidentally merged to a branch that I had 40+ local changes on - so now my changes and the merge are together, which I definitely do not want, with a lot of the files having edit & merge changes. I want to completely revert out the merge, is there a way to do this? If not, I'm in trouble.

I haven't checked anything in, I just only want to keep my local changes that I made.

Frix
  • 101
  • 1
  • 1
  • 8
  • Not get your response for several days, would you please share your latest information about this issue? If you have any concern, feel free to share it here. – Hugh Lin Jan 06 '20 at 01:37
  • @HughLin-MSFT Sorry, forgot about this post! I ended up taking solution - copied, reverted everything, and did a manual compare. – Frix Jan 07 '20 at 11:38

4 Answers4

3

If you merge to a branch via pull request in Azure Devops, then you can revert the completed pull request directly.

enter image description here

enter image description here

In Target branch, select the branch where you want to undo the pull request changes. In Topic branch name, select a new branch where the reverted changes are created, then select Revert.

Select Create pull request to merge the newly created branch in a second pull request to complete the revert. For details ,please refer to this document.

If I ignore something, you could attach detailed steps or flow for this issue , this would be much easier for me to understand and reply.

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25
2

I agree with Leo BL. You can try to copy your current project folder into temporary folder. Then checkout the merge source branch and compare it with temporary folder by some diff/merge tool. However, that maybe difficult to cut your changes if they were in the same files with the merge operation.

Shamrai Aleksander
  • 13,096
  • 3
  • 24
  • 31
  • I ended up doing exactly this. Took me about an hour, which wasn't too bad, but an hour wasted! – Frix Jan 07 '20 at 11:37
1

Just a quick hint: Basically, this is a git question. So maybe you should consider giving it the git tag aswell, so you can reach a greater audience.

Regarding your question: What means local change? Is the stuff not committed at all? What does git status show?

Assuming the changes are not committed, you could use git stash. I recommend this SO question:

Cancel git merge but keep local changes

I would try it this way: 1. Backup the directory (so you have a backup if something goes wrong) 2. Stash your changes 3. Revert the merge 4. Load the stashed changes —> You should be fine

Jonas
  • 305
  • 2
  • 16
0

sorry but you are in trouble. After the merge the files are replaced

Leo BL
  • 316
  • 1
  • 9