git new branch at commit code example

Example 1: create new branch git

$ git checkout -b [name_of_your_new_branch]

Example 2: git new branch

$ 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]

Example 3: commit to a new branch

git checkout -b your-new-branch
git add <files>
git commit -m <message>

First, checkout your new branch. 
Then add all the files you want to commit to staging. 
Lastly, commit all the files you just added. 
You might want to do a git push origin your-new-branch afterward so your changes show up on the remote.