Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a git pull update all tracked branches?

Tags:

git

Say I'm locally tracking 3 remote branches, master, branch1, branch2.

If I'm currently on the master branch, will a git pull fetch and merge changes on each of the branches?

I guess I could build out an experiment, too...

like image 605
tarabyte Avatar asked Oct 28 '15 22:10

tarabyte


People also ask

Does git pull pull everything?

The git pull command first runs a git fetch command to check for changes. The fetch operation returns the metadata for our commits . Then, the git pull command retrieves all the changes we have made to our remote repository and changes our local files.

Does git pull affect other branches?

It will only change your current local branch in the merge part, but the fetch part will update all of the other remote branches if they had changes since the last fetch.

Does git pull pull all remote branches?

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.

Does git pull update my local branch?

The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.


2 Answers

You can use either git pull --all to pull all the tracked remote branches or git fetch --all to fetch them and decide later how to proceed. Be aware that pull usually automatically merges any change and it is seldom what you want.

like image 100
skypjack Avatar answered Oct 04 '22 22:10

skypjack


No. git-pull will only ever incorporate changes to your local branch. If you want the updates for each other branch, you'll have to check them out and pull down their updates individually.

like image 39
Makoto Avatar answered Oct 04 '22 21:10

Makoto