Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Git Best Practices Guide

You're reading from   Git Best Practices Guide Master the best practices of Git with the help of real-time scenarios to maximize team efficiency and workflow

Arrow left icon
Product type Paperback
Published in Nov 2014
Publisher
ISBN-13 9781783553730
Length 102 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
PIDOUX Eric PIDOUX Eric
Author Profile Icon PIDOUX Eric
PIDOUX Eric
Arrow right icon
View More author details
Toc

Merging


A very nice process in Git allows you to combine the changes of two branches. This is called merging.

The git merge command performs a merge. You can merge changes from one branch to the current branch via the following command. Your local master branch is created as a tracking branch for the master branch of the origin repository:

Erik@local:~/webproject$ git checkout master
Erik@local:~/webproject$ git merge test

This command will merge test branch changes inside your current checked-out branch.

Fast forward merge

If the commits that are merged are direct predecessors of the HEAD pointer of the current branch, Git simplifies things by performing a so-called fast forward merge. This fast forward merge simply moves the HEAD pointer of the current branch to the last commit of the branch that is being merged.

This process is depicted in the following diagram. The first picture assumes that the master branch is checked out and you want to merge the changes of the branch labeled branch into...

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 $15.99/month. Cancel anytime
Visually different images