What is the difference between 'git pull' and 'git fetch'?
Rajanikant Hawaldar
Select an image from your device to upload
What is the difference between ‘git pull’ and ‘git fetch’?
git fetch will fetch changes from remote/main branch to your local branch but changes will not reflect on your local project / workspace. Whereas git pull will fetch changes from remote / main repository to local branch as well as local project / workspace.
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.
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.