3 ms·
Thanks knowtheory, that's exactly what I wanted to read, that git pull --rebase is "take all the commit nodes from my local branch (remember them), and rewind t
by acqq 17y ago
Thanks knowtheory, that's exactly what I wanted to read, that git pull --rebase is "take all the commit nodes from my local branch (remember them), and rewind the history back to the point where my repository was in synch with the remote repository. THEN update my repository with the remote changes, and try and apply all my local commits on top of my newly synched tree."" Now what's "git pull" explained in the same terms?
Is it "produce errors as if remote were in sync with local even if it's obvious it isn't"? Who needs that?
If it's not, then what is a proper description?
And is there any scenario in which remote was changed, you want to push there your changes and you wouldn't want "git pull --rebase"?
Thanks!
- lincolnq 17y ago"Normal" git development (without rebasing) naturally creates a branching history when two people make changes based off a common root. As was explained above, rebasing causes this branching history to be rewritten into a linear one. The alternative is merging, where you cause Git to record what actually happened -- which is that two changes occurred simultaneously and you explicitly brought them in sync again. Sometimes (often) this is what you want -- it's especially useful for longer-lived branches of work, where having the history of the branch can be valuable in itself. Also, if you share a commit with someone, you can no longer safely rebase it! The reason is that part of the definition of a commit is its set of parents -- the commits it depends on (usually 1, but can be 2 or more for a merge commit). When you rebase, you are rewriting all the parents, so you end up creating a whole stream of new commits and discarding the old ones. If you then attempt to share history with someone who has the old ones, presumably Git will become confused. (I've never actually run into this problem, but I don't use rebasing much.)
- acqq 17y agoThose are good arguments why "pull --rebase" is not a default action, thank you. Now I don't understand why either "pull" or "pull --rebase" is supposed to have any different behaviour when somebody does it! As far as I undestand git has enough information not to complain more in one case and less in another, and as far as I understood, the main argument of the main article was that "--rebase" somehow "eases some pain"!? How come?