git tfs branch –init –all errors
I used https://stackoverflow.com/a/13710811/260865 to get a tfs repo with branches in one git repo and it works fine for a couple of branches. But I wasn’t able to init all branches because of:
"C:\tmp\Main>git tfs branch --init --authors=C:\tmp\authors-file.txt $/someproject/Branches/7.2.0
The name of the local branch will be : Branches/7.2.0
error: The root changeset 26907 have not be found in the Git repository. The branch containing the changeset should not have been created. Please do it before retrying!!"
C:\tmp\Main>git tfs branch --init --authors=C:\tmp\authors-file.txt $/someproject/Releases/184.108.40.206 (renamed branch issue: https://github.com/git-tfs/git-tfs/pull/299)
The name of the local branch will be : Releases/220.127.116.11
An unexpected error occured when trying to find the root changeset.
Failed to find root changeset for $/someproject/Releases/18.104.22.168 branch in $/someproject/Main branch
TFS says that 22.214.171.124 is a child branch of Main.
git-tfs version 0.17.1.0 (TFS client library 126.96.36.199 (MS)) (32-bit)
Has someone a solution for that?
3 Solutions collect form web for “git tfs branch –init –all errors”
The problem is caused by the branch having been renamed. There is a issue for this here but it has not yet be resolved.
init-branch does not handle TFS branch renames
If I create a branch in TFS from my
Trunk and then rename the branch, when I attempt to execute
init-branch on the renamed branch it does not find the correct
changeset and complains that the original does not exist in the Git
“In TFS 2010 behind the scenes a rename is actually a branch and
delete process, this meant we ended up with the new branch, but also a
deleted branch of the old name. This is not obvious unless you have
‘show deleted items in source control explorer’ enabled…” That’s the
reason why git-tfs can’t handle this case because git-tfs can’t init a
branch when the parent branch has not been inited before 🙁 It’s the
2nd step of what I’ve planned to do to better handle merge changesets
and to allow automatically init a parent branch when root changeset
not found (after #363 is merged).
But it need a big refactoring (need to move a lot of methods from one
class to another)…
I have found a workaround that allows you to clone all branches even if they have renamed.
As Adam mentioned, renamed branches are deleted and recreated, and we need the “parent” commits to be cloned before the children.
1) Find a list of all deleted branches
I use Visual Studio -> Source Control Explorer -> click Show Hide Deleted Options toggle icon
2) In Ancestor Order,
git tfs branch --init $\Project\Branch_Location each deleted branch
The development made to support branch rename is now merged in master (but not yet released. Will be with the next release that should be 0.21).
It should solve most of the cases of rename (but with Tfs we are never sure 🙁 ). Feel free to test and report case that don’t work…