0

I would like to know if git pull will update all my branches or just the master branch?

Or

Does it just pull the current branch I am working in?

JohnNY
  • 539
  • 1
  • 3
  • 9

2 Answers2

2

It just updates the currently checked out branch.

More specific: it will fetch all the branches (= update the origin/* branches), and then merge the matching remote branch into the currently checked out branch. So if you’re in master, git pull is equivalent to:

git fetch
git merge origin/master

If you want to pull all the branches, have a look at this question: Can "git pull --all" update all my local branches?

Community
  • 1
  • 1
Chronial
  • 66,706
  • 14
  • 93
  • 99
  • so then it does not refresh my full repo? – JohnNY Feb 27 '13 at 00:25
  • 1
    no. you need to use `git fetch` directly for that, and you'd still have to update your local branches manually – Eevee Feb 27 '13 at 00:26
  • so I need to do a git fetch for each branch and then a merge? is it anything like a clone that will get them all – JohnNY Feb 27 '13 at 00:31
  • 1
    `git fetch` will get all your branches. you will still need to merge the remote branches into your local ones as needed – George Skoptsov Feb 27 '13 at 00:58
  • 2
    This answer is correct, but misleading. `git pull` combines `git fetch` _for_ _all_ _branches_ with `git merge` (or `git rebase`, if you have it configured that way) in the currently checked out branch. So if you have master checked out, `git pull` will merge the newly fetched origin/master into master. It will update all the other origin/* branches, after which you may manually merge in those changes if necessary. – ebneter Feb 27 '13 at 02:32
  • `git pull` runs `git fetch` with the same arguments—so if you're using the pretty common `git pull origin master`, that's what you'll fetch – Eevee Feb 27 '13 at 02:34
0

trygit pull --help

Incorporates changes from a remote repository into the current branch. In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.

zzk
  • 1,347
  • 9
  • 15