English feliratok

← Fast-Forward Merges - How to Use Git and GitHub

Beágyazókód kérése
5 Languages

Showing Revision 4 created 07/31/2017 by Dejan Trajkovic.

  1. At this point, you might have some questions.
  2. You might be wondering if git pull is the same as fetching and then merging.
  3. Why haven't our previous pulls generated merge commits like this one did?
  4. It's a fair question.
  5. The answer is fast-forward merges.
  6. This kind of merge occurs when you merge two commits,
  7. where one is ancestor of the other.
  8. That is, where one commit is reachable by the other.
  9. If all merges happened the way we've been showing you so
  10. far, if you took b and tried to merge it into a, then you would end up
  11. with a merge commit that had both commits as a parent, and you would move a.
  12. In the usual case, merge commits are generated to keep track of
  13. all the commits that played a part in getting to this new stage.
  14. But in this case, the commits that played those parts are this one and this one.
  15. And this commit already has all the information about this one's history.
  16. So there's not actual reason to add this extra one.
  17. So instead of adding a new commit,
  18. all we would do is update the label to point here instead.
  19. Hopefully, at this point the name fast-forward merge makes sense.
  20. We're taking a label from the history of a branch somewhere in its ancestry, and
  21. moving that label forward to the tip of the branch.
  22. Take a look at these commit histories.
  23. Check the box next to each diagram,
  24. where merging branch b into Branch a would result in a fast-forward merge.