Git Branching

Learn How to Manage Multiple Versions of a Project with Branching

Start[missing "en.views.course_landing_page.learn-git.course_illustration" translation]
Git Branching
Lesson 1 of 1
  1. 1

    Up to this point, you've worked in a single Git branch called [...] . Git allows us to create branches to experiment with versions of a project. Imagine you want to create version of a story wit...

  2. 2

    The diagram to the right illustrates branching. The circles are commits, and together form the Git project's commit history. New Branch is a different version of the Git project. It conta...

  3. 3

    Right now, the Git project has only one branch: [...] . To create a new branch, use: [...] Here [...] would be the name of the new branch you create, like [...] or [...] . Be sure to n...

  4. 4

    Great! You just created a new branch. The [...] and [...] branches are identical: they share the same exact commit history. You can switch to the new branch with [...] Here, [...] is th...

  5. 5

    Congratulations! You have switched to a new branch. All the commands you do on [...] , you can also do on this branch. For example, to add files to the staging area, use: [...] And to commit...

  6. 6

    What if you wanted include all the changes made to the [...] branch on the [...] branch? We can easily accomplish this by merging the branch into master with: [...] For example, if I wan...

  7. 7

    The merge was successful because [...] had not changed since we made a commit on [...] . Git knew to simply update [...] with changes on [...] . What would happen if you made a commit on [...

  8. 8

    Let's say you decide you'd like to merge the changes from [...] into [...] . Here's where the trouble begins! You've made commits on separate branches that alter the same line in conflicting...

  9. 9

    In Git, branches are usually a means to an end. You create them to work on a new project feature, but the end goal is to merge that feature into the [...] branch. After the branch has been integr...

  10. 10

    Let's take a moment to review the main concepts and commands from the lesson before moving on. Git branching* allows users to experiment with different versions of a project by checking out se...

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo

Git Branching

Start[missing "en.views.course_landing_page.learn-git.course_illustration" translation]