Merging Development Branch to Main: There were no changes to merge
Asked Answered
R

3

20

My main branch has some files that have different codes from the same file of development branch. The development branch is the one that has the correct version of these files but when I am trying to merge it to main branch(target); I am getting a message saying

There was no changes to merge

How can I resolve that problem so that the main branch has the correct version of those files?

Rafter answered 21/12, 2014 at 14:40 Comment(2)
See also: https://mcmap.net/q/664059/-force-a-merge-in-tfs-after-conflicts-have-been-resolved/736079Poultice
In my case it was distraction. I had already made the merge!Aprylapse
P
20

When merging files TFS doesn't just look at the differences between the two branches, but it also keeps track of whether you've ignored these changes in a previous merge attempt. When merging TFS offers you 3 options when there are conflicts:

  1. Merge
  2. Keep Source
  3. Keep Target

When you pick Keep target or when you manually merge and deselect certain changes, TFS will mark these changes as "resolved" and will not offer them again when you try to merge in the future. This is called a "merge credit".

You can also create these issues using the commandline when using tf merge /discard which will tell TFS to ignore the changes in those files/changesets when considering merges.

There are two ways to force TFS to reconsider these changes:

  1. Use force merge. On the commandline you can initiate a merge in which TFS will temporarily ignore it's records and will offer you every different file for merging. This can be a lot of work, but once done your merge history will be back in shape. To issue a force merge run tf merge $/Source/Folder/File $/Target/Folder/File /force /version:T This will almost certainly raise a merge conflict which you can resolve to get the right changes in the target branch.

  2. Undo the previous merge using Rollback. If you've recently done the merge in which changesets have been discarded. Find it in the history, rightclick the changeset and pick Rollback and check in the code that has been undone. This will actually remove all of the changes in that changeset and will reset the "merge credits". Once this has been done you can redo the merge and do it right this time. This can also be done from the command line using tf rollback

Poultice answered 21/12, 2014 at 14:54 Comment(4)
I tried to rollback but I get a message of error saying my file has incompatible pending changeRafter
First do a Undo Pending changes (or shelve your existing changes)Poultice
In case you have a moment Jesse - https://mcmap.net/q/664060/-revoking-tfs-merge-creditsHydranth
Option 1 worked for me, but I had to include /version:T in the command. The T tells the TF command to use the latest version.Rhythm
J
0

The force merge command is missing double quotes it should be like follows:

tf merge "$/Source/Folder/File.cs" "$/Target/Folder/File.cs" /force /version:T
Juju answered 5/4, 2023 at 9:12 Comment(0)
H
0

I just had a similar issue but mine was a different problem - make sure both your Source Control Explorer and your Pending Changes toolbox are pointing to the same workspace!

Handball answered 14/11, 2023 at 11:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.