A simple Graphical Representation for Beginners,
here,
git pull
will fetch code from repository and rebase with your local... in git pull there is possibility of new commits getting created.
but in ,
git fetch
will fetch code from repository and we need to rebase it manually by using git rebase
eg: i am going to fetch from server master and rebase it in my local master.
1) git pull ( rebase will done automatically):
git pull origin master
here origin is your remote repo master is your branch
2) git fetch (need to rebase manually):
git fetch origin master
it will fetch server changes from origin. and it will be in your local until you rebase it on your own. we need to fix conflicts manually by checking codes.
git rebase origin/master
this will rebase code into local. before that ensure you're in right branch.