# workflow, step by step:
git checkout srcBranch # where new branch will be created from
git branch newBranch # newBranch is created from srcBranch
git checkout newBranch # switch from srcBranch to newBranch
# in a single line:
git checkout -b newBranch srcBranch
git checkout -b newBranch # srcBranch is optional if already checked out
$ git checkout -b [your_branch_name]
# Switched to a new branch [your_branch_name]
# This is shorthand for:
$ git branch [your_branch_name]
$ git checkout [your_branch_name]
# To create a new local branch...
# ...based on the current revision:
$ git checkout -b <branch-name>
# ...based on a specific revision hash:
$ git checkout -b <branch-name> <commit-hash>
# create and switch to the new branch
git checkout -b <Name_of_your_branch>
# example
git checkout -b testBranch1
# if you check your current branch it will show you testBranch1
git checkout -b [yourbranchname]
git commit
Note: In Git version 2.23, a new command called git switch was introduced to
eventually replace git checkout
// Example for creating a new branch named myNewBranch
// git switch is specifically for branches while git checkout is for
// both branches and commits
git switch -c myNewBranch
// First Push
git push -u origin HEAD