The branch you try to init is a root branch (e.g. has no parents)
See original GitHub issueI have the folowing branch structure in TFS, as output by the
git tfs list-remote-branches
command (this was for a real project,
but I’ve changed some names):
$/Project/Main [*]
|
+- $/Project/Test
| |
| +- $/Project/Dev
| | |
| | +- $/Project/Feature/Feature1
| | |
| | +- $/Project/Feature/Feature2
When I attempt to clone everything into git by calling git tfs clone on
the main branch with the --with-branches flag, it doesn’t get any of those
branches and says that they are root branches with no parents, even though
in TFS I can see the hierarchy of the branches just fine. Here’s the
output of git tfs
:
$ git tfs clone http://tfs:8080/tfs/DefaultCollection "$/Project/Main" --with-branches
Initialized empty Git repository in c:/_Projects/Main/.git/
Fetching from TFS remote 'default'...
C25558 = 5035441892168a968c5b611a9bd802e59f028d93
C25568 = aa8bef4af8658273e8ab338ccadf30ae626d2270
Tfs branches found:
- $/Project/Test
- $/Project/Dev
- $/Project/Feature/Feature1
- $/Project/Feature/Feature2
=> Working on TFS branch : $/Project/Feature/Feature1
Branches to Initialize successively :
-$/Project/Feature/Feature1 (25570)
The name of the local branch will be : Feature/Feature1
error: an error occurs when initializing the branch. Branch is ignored and continuing...
=> Working on TFS branch : $/Project/Feature/Feature2
Branches to Initialize successively :
-$/Project/Feature/Feature2 (25570)
The name of the local branch will be : Feature/Feature2
error: an error occurs when initializing the branch. Branch is ignored and continuing...
=> Working on TFS branch : $/Project/Main
Warning: `git gc` failed!
warning: Some Tfs branches could not have been initialized:
- $/Project/Test
- $/Project/Dev
- $/Project/Feature/Feature1
- $/Project/Feature/Feature2
Please report this case to the git-tfs developers! (report here : https://github.com/git-tfs/git-tfs/issues/461 )
warning: Some Tfs branches could not have been initialized or entirely fetched due to errors:
- $/Project/Test
=>error:error : the branch you try to init '$/Project/Solution' is a root branch (e.g. has no parents).
- $/Project/Dev
=>error:error : the branch you try to init '$/Project/Solution' is a root branch (e.g. has no parents).
- $/Project/Feature/Feature1
=>error:error : the branch you try to init '$/Project/Solution' is a root branch (e.g. has no parents).
- $/Project/Feature/Feature2
=>error:error : the branch you try to init '$/Project/Solution' is a root branch (e.g. has no parents).
Please report this case to the git-tfs developers! (report here : https://github.com/git-tfs/git-tfs/issues )
The output of git tfs version
is:
git-tfs version 0.22.0.0 (TFS client library 12.0.0.0 (MS)) (64-bit)
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
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...
Read more >Solving “Fatal: Not A Git Repository” (Or Any Of The Parent ...
The error 'fatal: not a git repository' occurs when you try to run a Git command ... c. fatal: A branch named <branch-name>...
Read more >Git - Branches in a Nutshell
Branching means you diverge from the main line of development and continue to do work without messing with that main line. In many...
Read more >How to Get Started with GIT and work with GIT Remote Repo
It also references its parent commit(s), except the root commit which has no parent. A normal commit has one parent; a merge commit...
Read more >Source Control with Git in Visual Studio Code
You can checkout any branch in your repository by clicking that status indicator and selecting the Git reference from the list. Tip: You...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, but really. My solution was to give up on preserving the TFS history and just start a new git repo. You can keep the TFS repo around, and if you encounter any changes you want to review from before the switchover, you can go back to that. Though, my experience is that I never went back to those repos because it was a huge pain in the ass, and the history was not as important as I used to think it was. 😉
HINT: There were some changes done which deal with complex branching. This needs to be re-tried with the lastest version if it is still an issue!
We are trying to clean up old/stale issues. As this hasn’t seen any updates (or pull requests implementing it), can this issue be closed, please? We can reopen it in case further information is provided.