+1 vote
in Git by
edited by
What is the difference between GIT pull and GIT fetch?

2 Answers

0 votes
by

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

  • When you use pull, Git tries to automatically do your work for you. It is context sensitive, so Git will merge any pulled commits into the branch you are currently working in. pull automatically merges the commits without letting you review them first. If you don’t closely manage your branches, you may run into frequent conflicts.

  • When you fetch, Git gathers any commits from the target branch that do not exist in your current branch and stores them in your local repository. However, it does not merge them with your current branch. This is particularly useful if you need to keep your repository up to date, but are working on something that might break if you update your files. To integrate the commits into your master branch, you use merge.

0 votes
by

GIT pull command pulls new changes or commits from a particular branch from your central repository and updates your target branch in your local repository while GIT fetch pulls all new commits from the desired branch and stores it in a new branch in your local repository.

Related questions

0 votes
asked Aug 24, 2023 in Git by JackTerrance
0 votes
0 votes
asked Oct 26, 2020 in Git by AdilsonLima
...