• 0

How to create and checkout a git branch in a single command

Often when you create a new branch, you want to swtich to it immeditately. The usual way to do that is

git branch new-branch-name
git checkout new-branch-name

You can save yourself some keystrokes and combine these two commands into one

git checkout -b new-branch-name