Here is how you can do Reparenting for TFS branch.
Scenario: Before
- Development
- Release 1
- Release 2
Scenario: After
- Development
- Release 1
- Release 2
Now you want to bring Release 2 under development, then you need to do re parenting.
- Create Release 2 branch from Release
- Get the latest version of Release 2 locally.
- Get the latest version of Development branch locally.
- Add location of tf command (generally “C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE”) to your PATH.
- Open command prompt and go to the working folder of Release 2. If you don’t do this then you may get error related to workspace while running commands mentioned below.
- Now you need to perform a baseless merge from the development branch to Release 2. Make sure it is recursive. (why recursive ? because if you don’t do it recursive then while merging your changes from Release2 to development, and if you do it from the folder level, it would show you Release 1 as the parent. In that case, you should always start your merge by right clicking on the “Release 2” level. Which is annoying. So go for recursive. )
- Here is the command.
- Tf merge /baseless /recursive “$/Development” “$/Development/Release2”
- This command may take a while depending on the size of your source code.
- Once done, it will show you resolve conflict window. In my case, I don’t want changes from development branch to be merged into Release 2, so I choose Keep destination files. And resolve the conflict for all.
- Once done, you will have a big chunk of files ready for check in in Release 2 branch.
- Go ahead and check in.
- Once check in is done, right click on Release 2 and then select ReParenting (under branch and merging menu)
- You should be able to see Development branch there.
- Select it. And hit ok.
- All done. Release 2 has now Development as its parent.
Thanks