Actually Git maintains a copy of your own code and
the remote repository.
The command git fetch
makes your local copy up to date by getting data from remote repository. The reason we need this is because somebody else might have made some changes to the code and you want to keep yourself updated.
The command git pull
brings the changes in the remote repository to where you keep your own code. Normally, git pull
does this by doing a ‘git fetch’ first to bring the local copy of the remote repository up to date, and then it merges the changes into your own code repository and possibly your working copy.