Create a Branch

Learn different methods for branch creation in Git.

So far, we’ve learned the basic commands to keep adding changes as snapshots. It’s time to learn some more techniques.

In this chapter, we’ll learn to do the following:

  • We’ll learn to create branches.
  • We’ll learn to check out a specific commit.
  • We’ll learn to merge branches.
  • We’ll learn check the difference between commits.
  • We’ll learn to keep a clean commit history.
  • We’ll work with git add interactively to select only the changes we want to commit.

Create a branch

We can create a branch using git switch -c. For example, the following command creates a branch named ...