Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Move" changeset in wrong TFS branch

Tags:

tfs

Suppose that I check-in a change in the wrong TFS branch. I need to get my changes to a different branch then somehow eliminate those changes from the wrong branch. Can this be accomplished without resorting to selective copy/pasting? Eventually I do want my changes in the branch I mistakenly added them to... just not yet.

If I had not checked in the changes, I could shelve them, then use tfpt to unshelve into a different branch. But that won't work here, since I've already checked the changes in.


Example:

I have an environment with a MAIN and DEVELOPMENT branch. I need to create a new module, called Buzzsaw. I have a solution open and hack away on my changes. Then I check them in. Oops. I realize that I just checked my module into MAIN, but it should have been checked into DEVELOPMENT. I could rollback the mistaken changeset, but then I need to apply my changes to DEVELOPMENT manually. Most of the affected files are the same between the branches, but there are enough differences that I'd rather not copy/paste my changes.

I could merge my changes from MAIN to DEV, then rollback MAIN. But now it is difficult to bring the changes back to MAIN when I really do want them present (merging DEV to MAIN now doesn't move that changeset, since it was already merged).


What can I do? Is there a fairly clean way to accomplish this?

like image 222
Eric Avatar asked Jun 18 '12 18:06

Eric


People also ask

How do I merge changesets in another branch?

Use the drag and drop operation to merge branches You can use the drag and drop feature to merge a changeset or a branch to another branch. For more information, see Merge folders and files.

How do I merge two changesets in TFS?

You cannot merge multiple changesets in one go, unless the changesets are in sequence. Using the tf command line tool you specify a range of versions by separating the version with a tilde character. In this case the changes 162987 and 162967 will also be included.


1 Answers

Merge from the wrong branch to the correct one, then do an changeset rollback of the one in the wrong branch.

Whenever you need, you still can merge back the changeset from the correct branch to the wrong one.

like image 185
Nock Avatar answered Sep 28 '22 02:09

Nock