https://stackoverflow.com/questions/292357/what-is-the-difference-between-git-pull-and-git-fetch
To understand this, you first need to understand that your local git maintains not only your local repository, but it also maintains a local copy of the remote repository.
git fetch brings your local copy of the remote repository up to date. For example, if your remote repository is GitHub - you may want to fetch any changes made in the remote repository to your local copy of it the remote repository. This will allow you to perform operations such as compare or merge.
git pull on the other hand will bring down the changes in the remote repository to where you keep your own code. Typically, git pull will do a git fetch first to bring the local copy of the remote repository up to date, and then it will merge the changes into your own code repository and possibly your working copy
Refer this:
Command |
Git Fetch <Remote> |
Git Pull <Remote> <Branch> |
Merging |
Does Not Modify Your Working Branch |
Automatically Merges Changes Into Your Branch. |
Control |
Gives You Time To Review Changes. |
Directly Integrates Remote Changes |
Handling Conflicts |
No Conflicts, As No Merge Is Performed. |
Merge Conflicts Might Arise Immediately. |