How can I migrate files to another branch without checking them in?

595 Views Asked by At

tfpt.exe is not exist anymore from VS 2017 and beyond. So how can I move files from one branch to another without checking them in. Say I've accidentally written code in the wrong branch or I'm told to move my change to a different version before checking in. This happens all the time. If there is not a way to do this, then either TFS is broken or I'm using it wrong.

This no longer works:

tfpt unshelve /migrate /source:"$/MyProject/DevCurrent/DevMain" /target:"$/MyProject/DevNext/DevMain" "Temp"

Please don't mark this question as duplicate without making sure it actually is. I've been researching this all day, and there have been 15 million different ways of doing this over the past ten years none of which work on modern tooling.

I need a solution for TFS 2018 and Visual Studio 2017. I do not have control over these versions.

2

There are 2 best solutions below

4
Shayki Abramczyk On

This happens all the time.

Why? it shouldn't happens all the time. check where you are and then start coding.

I've been researching this all day

So I guess you see this question, if the answers there not good for you, let me suggest a simple way to do that, but it's manual way and not just run a command:

1) You change a file and suddenly you put attention that you are in the wrong branch.

2) You don't want check-in the changes to the wrong branch.

3) In the past you put the file in Shelveset and then tfpt ..., but now the command no longer exist.

3) No problem. Go to your local folder, copy the file (with the changes).

4) Go to the correct branch local folder and paste the file there.

5) Go to Pending Changes and "Undo" the changes in the wrong branch.

6) Check in only the file in the correct branch.

0
Kelon On

After I had the same problem with VS2019, my best way to to it was to copy/paste the modified source folder to the branch target folder and use

tf reconcile /promote

to detect all added or changed files.