Question ListCategory: QuestionsWhat is the difference between ‘git pull’ and ‘git fetch’?
Neha asked 10 months ago
Both updates the local repository.  When exactly to use each command?
1 Answers
Aaksh answered 10 months ago

The git pull  do two things , it fetches the changes from central git repository to the local one. Then merges the changes.  If you do git fetch then central changes will be in local repository as well. Later you can do the merge.  As git is a distributed subversion control system. Each local copy is full repository. In case of central server failure, full repository can be again created from a local copy. So fetch is used where the copy of all changes need to keep updated on local repository.  Will help to recreate repository again.