Learn Version Control with Git
Understanding Branching 

& Merging in Git
The World Without Branches
Login Feature New Design #1 Bugfix #213
C1 C3 C7C5C2 C6C4
CHAOS
What happens if your client does...
Branches to the Rescue
C1 C5
Login
Feature
New Design #1
Bugfix #213 C4
C3 C7
C2 C6
each topic gets its own context,
comple...
Pointers and the HEAD
C1
C2
C3
contact-form HEAD
master
branches are just pointers
on commits (no magic…)
at any time poin...
Switching the Active Branch
the “checkout” command moves the
HEAD pointer to a different branch - 

and thereby makes that ...
Switching the Active Branch
to switch the active branch
simply double-click it
in a desktop app like Tower
all local branc...
Merging Branches
$ git merge contact-form
merging integrates all the commits
(the ones you don’t have, yet) from the
speci...
Learn Git with our free online book on
www.git-tower.com/learn
Prochain SlideShare
Chargement dans... 5
×

Understanding Branching and Merging in Git

3,689

Published on

Branches are a core tool in Git. Learn to understand the basic concepts - and use all of their advantages in your projects.

0 commentaires
4 mentions J'aime
Statistiques
Remarques
  • Soyez le premier à commenter

Aucun téléchargement
Vues
Total des vues
3,689
Sur Slideshare
0
À partir des ajouts
0
Nombre d'ajouts
2
Actions
Partages
0
Téléchargements
24
Commentaires
0
J'aime
4
Ajouts 0
No embeds

No notes for slide

Understanding Branching and Merging in Git

  1. 1. Learn Version Control with Git Understanding Branching 
 & Merging in Git
  2. 2. The World Without Branches Login Feature New Design #1 Bugfix #213 C1 C3 C7C5C2 C6C4 CHAOS What happens if your client doesn’t like “New Design #1”? How do you get (only) that code out? If “Login Feature” introduces a bug, all of your code contains this bug! What if you need to release “Login Feature”? It already contains “New Design #1” - which you maybe don’t want to release…
  3. 3. Branches to the Rescue C1 C5 Login Feature New Design #1 Bugfix #213 C4 C3 C7 C2 C6 each topic gets its own context, completely separated from any other context - If something goes wrong, only this context has the problem! - Creating and deleting contexts is quick & easy!
  4. 4. Pointers and the HEAD C1 C2 C3 contact-form HEAD master branches are just pointers on commits (no magic…) at any time point in time, only one branch can be active = checked out = HEAD in Git, you are always working on a branch!
  5. 5. Switching the Active Branch the “checkout” command moves the HEAD pointer to a different branch - 
 and thereby makes that branch active $ git checkout master C1 C2 C3 contact-form master HEAD
  6. 6. Switching the Active Branch to switch the active branch simply double-click it in a desktop app like Tower all local branches are listed in the sidebar
  7. 7. Merging Branches $ git merge contact-form merging integrates all the commits (the ones you don’t have, yet) from the specified branch into your current HEAD C1 C2 contact-form master HEAD C3 C4 merge commit C5
  8. 8. Learn Git with our free online book on www.git-tower.com/learn
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×