DEV Community

Xun Zhou
Xun Zhou

Posted on

Difference between 'git fetch' and 'git pull'

git fetch
Enter fullscreen mode Exit fullscreen mode

git fetch fetches branches and/or tags from remote repositories. Remote-tracking branches are updated in local environment.

git pull
Enter fullscreen mode Exit fullscreen mode

git pull does both git fetch and git merge as default, i.e. the changes on the remote target branch will be fetched and merged to our local branch. With option --rebase, it can rebase the remote changes on the current branch instead of merge strategy.

Top comments (0)