I cannot get Git to fetch new branches on the remote. git remote show
will not show that any branch other than master exists, but git ls-remote
proves that they exist.
Example: git ls-remote
shows that the branch homodyne_process exist-
$ git ls-remote origin
b935ee960a588144d3df0f08a82b81ea705c7543 HEAD
f11bd3ac9c2345a12edb9d49cd5bd027616b2226 refs/heads/homodyne_process
b935ee960a588144d3df0f08a82b81ea705c7543 refs/heads/master
Fetch updates and show remote branches
$ git fetch
$ git remote show origin
* remote origin
Fetch URL: [email protected]:***
Push URL: [email protected]:***
HEAD branch: master
Remote branch:
master tracked
Local branches configured for 'git pull':
master merges with remote master
Local refs configured for 'git push':
homodyne_process pushes to homodyne_process (fast-forwardable)
master pushes to master (up to date)
$ git branch -r
origin/master
I managed to get the homodyne_process pushes (...)
line after running
git pull origin homodyne_process:homodyne_process
but it still won't show that the remote branch does exist. Why does this happen?
I have also tried any git fetch origin homodyne_process
and lots of combinations, but the branch origin/homodyne_process
will not appear.
I am working on windows and the repo is hosted via gitolite.
(I have removed some other branches from the output, for brevity. )
Fetch command will retrieve all changes from the remote branch which do not exist in the local branch.
Git fetch commands and optionsFetch all of the branches from the repository. This also downloads all of the required commits and files from the other repository. Same as the above command, but only fetch the specified branch. The --dry-run option will perform a demo run of the command.
1 Answer. git fetch --all and git pull -all will only track the remote branches and track local branches that track remote branches respectively. Run this command only if there are remote branches on the server which are untracked by your local branches. Thus, you can fetch all git branches.
fetch will not update local branches (which track remote branches); if you want to update your local branches you still need to pull every branch. fetch will not create local branches (which track remote branches), you have to do this manually.
This answer solved my question: https://stackoverflow.com/a/25941875/1982894.
Basically I needed to run
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
This sets git to fetch all remote branches and not just master. The original configuration was:
$ git config --get remote.origin.fetch
+refs/heads/master:refs/remotes/origin/master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With