Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Git Essentials - Second Edition

You're reading from  Git Essentials - Second Edition

Product type Book
Published in Nov 2017
Publisher Packt
ISBN-13 9781787120723
Pages 238 pages
Edition 2nd Edition
Languages
Author (1):
Ferdinando Santacroce Ferdinando Santacroce
Profile icon Ferdinando Santacroce

Merging branches

Yes, I know, probably there's a thought on your mind since we start playing with branches: why he doesn't talk about merging?.

Now the moment has arrived.

In Git, merging two (or more!) branches is the act of making their personal history meet each other. When they meet, two things can happen:

  • Files in their tip commit are different, so some conflict will rise
  • Files do not conflict
  • Commits of the target branch are directly behind commits of the branch we are merging, so a fast-forward will happen

In the first two cases, Git will guide us assembling a new commit, a so-called merge commit; in the fast-forward case instead, no new commit is needed: Git will simply move the target branch label to the tip commit of the branch we are merging.

Let's give it a try.

We can try to merge the melons branch into the master one; to do so, you have to check...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}