question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

git does not list all branches listed by git-tfs

See original GitHub issue

I initialized a repo via

git tfs clone https://my/tfs/DefaultCollection $/My/MainBranch

it also initialized some other branches, i guess due to merge changesets. The left out branches were initialized via f.e.

git tfs branch --init $/My/Release/Release 4.2

If i issue a

git branch

it lists

  Releases/Release4.2
  Releases/Release4.4
  Releases/Release5.5
* master

So only the branches that have been initialized manually with the git tfs branch --init command. If i do a

git tfs branch

it lists:

Git-tfs remote details:

 Releases/Release5.0 -> https://my/tfs/DefaultCollection $/Product/Releases/Release 5.0
        refs/remotes/tfs/Releases/Release5.0 - 91467e33ea467f66de214c164843038cbeaf07f7 @ 15081

 Releases/Release3.0 -> https://my/tfs/DefaultCollection $/Product/Releases/Release 3.0
        refs/remotes/tfs/Releases/Release3.0 - 04e538a215502c6ba111e5d8358c79a8f8bf265f @ 10684

MUCH MORE...

 Releases/Release4.2 -> https://my/tfs/DefaultCollection $/Product/Releases/Release 4.2
        refs/remotes/tfs/Releases/Release4.2 - a7172305a46c950a7b7a5ab1fd90be51ebffd9c3 @ 13102

How can I get the branches initialized automatically into my git repo?

If i do a

git tfs branch --init "$/Product/Releases/Release 5.0" --debug

I get:

Command run:git tfs branch --init $/Product/Releases/Release 5.0 --debug
No authors file used.
git-tfs version 0.25.0.0 (TFS client library 14.0.0.0 (MS)) (64-bit)
git command: Starting process: git --version
git command time: [00:00:00.0227688] --version
Commits visited count:1
warning : There is already a remote for this tfs branch. Branch ignored!

EDIT: I recognized that for all manually created branches there is a .git/refs/heads/…/BranchName file. For all branches automatically initialized this file is missing.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
danielbisarcommented, Mar 22, 2016

Ok there was something missing in your command. The following works as expected

git checkout -b Release2.6 remotes/tfs/Releases/Release2.6

thanks.

0reactions
spraintscommented, Mar 22, 2016

But i am not sure why git tfs does not created this file when doing git tfs clone https://my/tfs/DefaultCollection $/My/MainBranch

git-tfs is just trying to set up one branch for you in this case. git-tfs is kind of acting like git clone. If you git clone https://github.com/git-tfs/git-tfs and run git branch, it only lists master even though there are more branches than that. The difference is that when you run git checkout better-releasing in the git-tfs clone, git recognizes that there’s an origin/better-releasing and automatically sets that up a local branch for you. git checkout -b Release2.6 tfs/Releases/Release2.6 does basically the same thing (start a local “Release2.6” branch, starting from “tfs/Releases/Release2.6”).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git Tfs not showing all branches
The Releases/20.1 and Releases/21.1 local branches are missing. I've run # git tfs branch --init $/MyProject/Releases/20.1 warning : There ...
Read more >
Prune TFS branches
In my case, I have previously initialized a branch that existed on the TFS but has been removed since. So running `git tfs...
Read more >
git tfs fetch: not updating (beginner question)
Using the command 'git branch -av' I get a list of the local branches with the latest commit message on the 28th (day...
Read more >
Git - git-branch Documentation
With --contains , shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of...
Read more >
Listing branches
Git provides multiple commands for listing branches. All commands use the function of git branch , which will provide a list of a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found