I've tried git branch -r
, but that only lists remote branches that I've tracked locally. How do I find the list of those that I haven't? (It doesn't matter to me whether the command lists all remote branches or only those that are untracked.)
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
Using
git branch -r
lists all remote branches andgit branch -a
lists all branches on local and remote. These lists get outdated though. To keep these lists up-to-date, runwhich will update your local branch list with all new ones from the remote and remove any that are no longer there. Running this update command without the --prune will retrieve new branches but not delete ones no longer on the remote.
You can speed up this update by specifying a remote, otherwise it will pull updates from all remotes you have added, like so
You also may do
git fetch
followed by agit branch -r
. Without fetch you will not see the most current branches.TL;TR;
This is the solution of your problem:
or:
I ended up doing a mess shell pipeline to get what I wanted, just merged branches from the origin remote:
try
For the vast majority[1] of visitors here, the correct and simplest answer to the question "How do I list all remote branches in Git 1.7+?" is:
For a small minority[1]
git branch -r
does not work. Ifgit branch -r
does not work try:If
git branch -r
does not work, then maybe as Cascabel says "you've modified the default refspec, so thatgit fetch
andgit remote update
don't fetch all theremote
's branches".[1] As of the writing of this footnote 2018-Feb, I looked at the comments and see that the
git branch -r
works for the vast majority (about 90% or 125 out of 140).If
git branch -r
does not work, checkgit config --get remote.origin.fetch
contains a wildcard (*
) as per this answer