Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I do git fetch before pull if branch exists locally?

I have following question about git.

I novice with git. I want to get last state of branch1 locally.

now I switched on branch2 and branch1 exists locally.

Now I make

  1. fetch
  2. switch to branch1
  3. pull

Please clarify me whether does first fetch redundant or not?

like image 862
gstackoverflow Avatar asked Sep 10 '25 14:09

gstackoverflow


1 Answers

It is redundant. Quoting the docs:

More precisely, git pull runs git fetch with the given parameters and calls git merge to merge the retrieved branch heads into the current branch.

like image 63
raina77ow Avatar answered Sep 13 '25 06:09

raina77ow