Sebastian
Sebastian

Reputation: 23

List remote branches that have been fetched

Using git branch command you can list all local branches, but I am trying to check if a remote branch is known by the local repository. For example there is a branch upstream/remoteBranch which has no copy on local repository. I do git fetch so my local repository knows the remoteBranch now. I can use it's name in commands like git diff upstream/remoteBranch localBranch, but it's not listed in the list of local branches (which is ok, because remoteBranch is not a local branch) and I'd like to list also remote branches. Is there any way to list all branches including those on upstream that have been fetched or at least check if specific branch has?

Upvotes: 0

Views: 115

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521289

If you run the following:

git branch -a

then Git will show you all local and remote tracking branches which it knows about. I don't see much point in querying to find out which remote branches you have not yet seen. Typically, you would just run a git fetch if you were in doubt as to what is available.

Upvotes: 1

Related Questions