• J'aime
Understanding Branching and Merging in Git
Prochain SlideShare
Chargement dans... 5
×

Understanding Branching and Merging in Git

  • 3,055 vues
Transféré le

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

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

  • Full Name Full Name Comment goes here.
    Êtes-vous sûr de vouloir
    Votre message apparaîtra ici
    Soyez le premier à commenter
Aucun téléchargement

Vues

Total des vues
3,055
Sur Slideshare
0
À partir des ajouts
0
Nombre d'ajouts
2

Actions

Partages
Téléchargements
13
Commentaires
0
J'aime
3

Ajouts 0

No embeds

Signaler un contenu

Signalé comme inapproprié Signaler comme inapproprié
Signaler comme inapproprié

Indiquez la raison pour laquelle vous avez signalé cette présentation comme n'étant pas appropriée.

Annuler
    No notes for slide

Transcript

  • 1. Learn Version Control with Git Understanding Branching 
 & Merging in Git
  • 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. 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. 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. 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. 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. 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. Learn Git with our free online book on www.git-tower.com/learn