MaciejLisCK
MaciejLisCK

Reputation: 3964

How to create branch on TFS with attaching pending changes to new branch

I was working on main branch and I have done a lot of changes to files. I did not check in those changes. How to create child branch from main, but all local pending changes which are attached to main branch, changes to be attached to newly created child branch.

So basically: How to create child branch with attaching all pending changes of parent branch to child branch?

Upvotes: 5

Views: 2774

Answers (2)

Yitz
Yitz

Reputation: 1306

For anyone asking this with later versions of Visual Studio, which don't have Power Tools available, you can do this manually.

  1. Create new branch
  2. Check in the branch (which will equal to last check in on main)
  3. Delete all files in the newly created branch folder
  4. Copy the contents of main branch folder to new branch
  5. Undo changes on main branch

You might want to take a local backup of the main branch first. Also, clean the solution folder first to make the copying quicker (packages/node_modules/bin/obj etc)

Upvotes: 0

Dylan Smith
Dylan Smith

Reputation: 22235

You can shelve your changes, then use the TFS Power Tools to unshelve them into a different branch.

This is a specific feature of the Power Tools (tfpt unshelve /migrate). It will rewrite server paths to migrate the changes into another branch. See this blog post for more info: http://geekswithblogs.net/TarunArora/archive/2011/06/06/unshelve-shelveset-created-from-one-branch-to-another.aspx

Upvotes: 9

Related Questions