Answer the question
In order to leave comments, you need to log in
Master branch update: git pull VS git pull --rebase?
The task is to pull the latest changes from the origin branch and not “litter” the history.
1) The traditional option is (master) $ git pull origin master
, but it does merge and leaves a "mark" of the merge.
2) Make (master) $ git pull --rebase origin master
, which completely replaces the contents of the repository with the latest up-to-date one (with the exception of local commits).
Am I understanding both options correctly? If so, which option is “more correct” to solve the problem?
Answer the question
In order to leave comments, you need to log in
You misunderstood the second option git pull --rebase origin master,
which removes your local commits, updates the branch (usually fast-forward), and then reapplies your commits after the update.
And git fetch updates your origin repository, but does not apply the received changes to your working copies.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question