Search code examples
gitmergecommitpreservefast-forward

Git: does ffwd merge preserves all topic branch commits?


Say we have this situation:

       master
         |
A--B--B--D--E--F--G
                  |
                test

Then we merge test into master. Are commits E and F preserved in the new master branch?

That is, does it now lok like this (option A):

                master
                  |
A--B--B--D--E--F--G
                  |
                test

or like this (option B):

          master
            |
A--B--B--D--G
            |
          test

Sorry if this has already been asked, I couldn't find it. Also, the example in ProGit book is with only one commit ahead (in my example that would be E), which doesn't tackle a situation like this.


Solution

  • What happens it option A: commits are preserved. In case of a fast-forward merge the history is not modified at all, only the master branch points at a different commit. That's all.