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 fetch : It fetch changes but don't update local file with new change. git pull: It pull changes and update local file with changes.
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.