We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

New Branch

You should already be on the main branch: your "default" branch. You can always check with git branch.

Two Ways to Create a Branch

git branch my_new_branch

This creates a new branch called my_new_branch. The thing is, I rarely use this command because usually I want to create a branch and switch to it immediately. So I use this command instead:

git switch -c my_new_branch

The switch command allows you to switch branches. Including the -c flag tells Git to create a new branch and switch to it.

When you create a new branch, it uses the current commit you are on as the branch base. For example, if you're on your main branch with 3 commits, A, B, and C, and then you run git switch -c my_new_branch, your new branch will look like this:

Assignment

Run and submit the CLI tests.

Troubleshooting

The switch command was introduced in Git version 2.23.0, so you might not have it if you're using an older version of Git.