The same answer that I did in the git-tfs forum but because you asked your question here also...
Any idea on how to fix it?
Don't know... But I know what you did wrong :-(
If you want to check in in a new tfs branch, you MUST create it before (and init it with git tfs branch --init
) or create it with the command git tfs branch
. And then you can work with it in git.
If you failed to do it at the beginning , you could do it before the rcheckin and doing a git rebase...
And now, you are able to rcheckin in the branch...
Git-tfs is able to find automatically the branch in which the check-in should be done by using the metadata stored in the last commit checked in tfs. In your case that was the one of the main branch!
Now, solving your problem.............
Because you can't delete a changeset with tfs it won't be an easy thing :-(
The easier solution is to create a new commit that revert all the changes and rcheckin it in tfs. After that, your master branch should be in the same state that before the check-in of the branch commits.
Then, create a git branch on the last changeset corresponding to the commit of the dev branch that you previously badly rcheckin.
Create a tfs branch, like I said earlier (you should have a new commit with the good metadata git-tfs-id
, look carefully at the TFS path!)
And use git rebase --onto -i
to rebase the commits of the dev branch onto this new commit. Don't forget to remove ALL the metadata of all the commits that you will rebase (or you will end in the same mess again)!!
Now you could rcheckin in the TFS branch!