What is difference between "git pull" and "git fetch" in Git?
Hello, I just switch from SVN to Git. I only know a little about Git with git clone
, git push
, git pull
. And today I know more about git fetch
.
I research on the internet I feel it same with git pull. So what is the difference between git pull
and git fetch
?
I only know git pull
helps me get all new code from the current branch I'm working for.
Now I really don't know when I should use git pull
or git fetch.
Thank you many for any clear explanation!!!
-
P1
PTJ312 Nov 13 2021
git fetch
is the command that tells your local git to retrieve the latest data info from the original branch, ONLY see have any new commit from original not update that to local git.git pull
on the other hand does that AND brings (copy) those changes from the remote repository and APPLY all that new change to local git. -
א0
אופק סדלובסקי Nov 13 2021
git pull
command is used to fetch and download content from a remote repository and immediately update the local repository to match that content.git fetch
command will downloads commits, files, and refs from a remote repository into your local repo but not update immediately.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.