DEV Community

Danyson
Danyson

Posted on • Updated on

What is the difference between 'git pull' and 'git fetch'?

git fetch
Enter fullscreen mode Exit fullscreen mode

Explanation: git fetch fetches commits from the target branch that is not in our current local branch and stores them in our local repository.

It does not merge. Which means we have the changes from target branch but not yet merged to our local branch.

git pull
Enter fullscreen mode Exit fullscreen mode

Explanation: git pull does both git fetch and git merge.

Which means changes from target branch will be fetched and merged to our local branch.

Support Us: Buy Me a Cookie 🍪

Top comments (0)