What is the difference between git pull and git fetch + git rebase? – Stack Overflow
Posted by jpluimers on 2026/02/04
Great Question, Answer and Comment at [Wayback/Archive] What is the difference between git pull and git fetch + git rebase? – Stack Overflow (thanks [Wayback/Archive] michael, [Wayback/Archive] gawkface and [Wayback/Archive] Daniel K.):
Q
Another question says that
git pullis like agit fetch+git merge.But what is the difference between
git pullandgit fetch+git rebase?A
TLDR:
git pullis like runninggit fetchthengit merge
git pull --rebaseis likegit fetchthengit rebaseIn reply to your first statement,
git pullis like agit fetch+git merge.“In its default mode, git pull is shorthand for
git fetchfollowed bygit mergeFETCH_HEAD” More precisely,git pullrunsgit fetchwith the given parameters and then callsgit mergeto merge the retrieved branch heads into the current branch”(Ref: git-scm.com/docs/git-pull)
For your second statement/question:
‘But what is the difference between
git pullVSgit fetch+git rebase‘Again, from same source:
git pull --rebase“With –rebase, it runs git rebase instead of git merge.”
Now, if you wanted to ask
‘the difference between
mergeandrebase‘that is answered here too:
git-scm.com/book/en/v2/Git-Branching-Rebasing
(the difference between altering the way version history is recorded)C
I’d like to mention that “git pull –rebase” is like “git fetch then git rebase” most of the time – but not always. In some situations, “git pull –rebase” does a bit more. See this often referenced example here: gitolite.com/git-pull–rebase
References from them:
- [Wayback/Archive] version control – What is the difference between ‘git pull’ and ‘git fetch’? – Stack Overflow
- [Wayback/Archive] Git – git-pull Documentation
- [Wayback/Archive] Git – Rebasing
- [Wayback/Archive] what does “git pull –rebase” do?
--jeroen






Leave a comment