Git Branches

As you may recall from the Git remotes lesson, it’s very common for large teams to use Git. That’s because Git enables smooth collaboration between many programmers who are all making changes to a repository at the same time. Even with Git, a situation where everyone works off the `master` branch could become cumbersome for the end-user. Team members will also have issues pushing to the remote, because Git has no way to determine which changes are the “correct” ones. As a result of Git not knowing which ones are the “correct” changes, this results in merge conflicts.

Luckily, Git gives us a few ways to avoid merge conflicts. The best method involves using branches. Similar to the way tree branches diverge from the trunk, Git branches allow us to create several different work areas within the same repository. It’s common to create a new branch whenever we want to make a change to a project, and then merge that branch back into the `master` branch when we’re done. Working on different branches will make their software development process go much faster.

In this lesson, we will talk about other benefits there are to using branches, as well as how to create and work with branches. You will discover how to create branches using the `git branch` command, how to switch branches using `git checkout`, as well as other important concepts when creating and working with Git branches.

As you work through each concept, you’ll get to apply what you’ve learned from within your browser; there’s no need to use your own machine to do the exercises. The Python environment inside of this course includes answer-checking to ensure you’ve fully mastered each concept before learning the next.


  • Learn to organize code using Git branches.
  • Learn to merge and delete Git branches.
  • Learn to explore different branch histories.

Lesson Outline

  1. Introduction to Git Branches
  2. Switching Branches
  3. Pushing a Branch to a Remote
  4. Merging Branches
  5. Deleting Branches
  6. Checking Out Branches From the Remote
  7. Finding Differences Across Branches
  8. Branch Naming Conventions
  9. Branch History
  10. Takeaways

Get started for free

No credit card required.

Or With

By creating an account you agree to accept our terms of use and privacy policy.