Tag Archives: git pull vs git fetch

git pull vs git fetch

git pull — Incorporates changes from a remote repository into the current branch. In its default mode,

In the simple terms, git pull does a git fetch followed by a git merge.

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. With –rebase, it runs git rebase instead of git merge.

You can do a git fetch at any time to update your remote-tracking branches under refs/remotes/<remote>/.

A git fetch, operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy.

A git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.