TerrorBight
TerrorBight

Reputation: 313

TFS reparent individual files

I know it's possible to reparent a TFS branch - I wanted to know if it possible to reparent an individual file (or at least modify the parent of a file in a branch to a different file within the parent branch). I have a case where I have copied/renamed files in the child branch - now when I TFS merge the file is being merged to a different file

Upvotes: 0

Views: 163

Answers (2)

TerrorBight
TerrorBight

Reputation: 313

Having look thru a number of posts and a bit of trial and error, the conclusion for me is for a child branch, TFS is much happier if every checkin is 'merged' (not just the most recent) - when I say merged, I really mean 'dealt with'.

So when a check-in is done, immediately merge across (via merge selected changesets).

For historic changesets that have not been merged (i.e. outstanding/historic check-ins in the child branch), I found the best way to deal with merging was to :-

  • turn off auto-merge (http://www.alliedc.com/turn-off-tfs-auto-merge-in-vs-2012/ )
  • perform a child branch merge (right-click on child branch | Branching and merging | Merge | Selected changesets)
  • start at the bottom, choose the last item
  • files in the changeset will try to be merged, some may be marked as conflicts (those marked in conflict will have yet to be changed)
  • in the conflicts dialog, ‘Compare Target to Source’; if there are a lot of changes it may be that many of these are already integrated so try an AutoMerge if the button is available, then check the delta (Compare with Latest in the Pending Changes panel)
  • if AutoMerge isn't available, check whether the historic changeset change has already been integrated into the target's most recent version (note if there is a conflict 'Compare with Latest' will show no diffs); to confirm whether the change has been integrated ‘Compare Target to Source’ and/or ‘Merge Changes in Merge Tool’ then ‘Compare with Latest’; note the merge is not checked-in yet so can simply be Undone
  • if the change has already been integrated into the target, 'Choose Target' (for the historic merges there may be a lot of these)
  • if the change has not already been integrated be careful merging in (as mentioned TFS merge works with the change being integrated)
  • if necessary, it may be a case of manual intervention to resolve the merge

Upvotes: 0

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30422

No, we can not reparent the individual files.

You are trying to modify the file history, but the Version history is immutable in TFVC. You cannot modify version control history, that is the changes that comprise a changeset.

You can try to get back to the specific version which not been merged, then right click the file >> Branching and Merging >> Merge >> then select the correct target branch file to merge.

enter image description here

Upvotes: 2

Related Questions