E
E
Evgeny Matveev2013-11-26 11:46:22
git
Evgeny Matveev, 2013-11-26 11:46:22

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

3 answer(s)
T
toxa82, 2013-11-26
@Masaki42

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.

E
egor_nullptr, 2013-11-26
@egor_nullptr

git pull --no-commithave you tried?

C
CrazySquirrel, 2013-11-26
@CrazySquirrel

git fetch?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question