We have tools that use history data from master to determine what files are available to download. When using "git pull", the fetch part of that command gets the history of master and thus everything works fine. However, git pull (remote) (branch) only fetches that branch, which sometimes breaks our tools. Is there a way configure git pull (remote) (branch) to also fetch one or all other branches instead of just that branch?
You literally can't do what you're asking for: git pull origin name
fetches only the one branch by design. But it doesn't matter: git pull
is a bad tool and you should just not use it.
All git pull
does is run git fetch
first, followed by git merge
or git rebase
second. Since you have your own tools, just code them to run git fetch
first followed by your chosen second Git command second. You now control how you run git fetch
, so you can choose to fetch both master
and one particular branch, or all branches (the default). Then you run the second command that git fetch
would have run: if you were going to do:
git pull origin mybranch
you just run instead:
git fetch origin && git merge origin/mybranch
(assuming you don't mind the minor difference around the default merge message), or:
git fetch origin && git rebase origin/mybranch
if you prefer git rebase
as the second command.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.