git rebase 与 merge
为情所困
为情所困 2017-04-27 09:03:25
0
1
565

git rebase 是不是就是跟 merge master 到你的 branch 产生代码的效果一样的, 不考虑 history log 等其他的因素

为情所困
为情所困

reply all(1)
为情所困

You said you won’t consider History Log, so there’s nothing more to say...

But in fact, Rebase has no direction constraints. You can Rebase Master to your branch, or vice versa. Rebase any branch to any target.

Essentially, Merge ignores the differences in the historical records of the two trees, and only merges the differences at the moment of executing Merge; while Rebase is to sort out the differences in the historical records of the two trees, and then merge.

Memories you can visualize:

  1. Merge means "to merge into one" (note that I said "and", not "two", because Merge does not only merge two parties)
  2. Rebase means "Put you below me, I will stand on top of you, and finally merge."

For example, I separated a branch from master and made some commits based on it. At this time, there are also new commits by others on master. If I merge master on the new branch, a new commit will appear on my branch, recording the combination of my changes and those on master. It's like two lines merged into one. If I rebase, starting from the point where I detached, new commits on master are populated first, and then my own commits are rewritten on top of the updates. So the content is still merged, but the history is sequential. From your point of view, it is as if it has never been separated from master.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template