Create New Branch

git branch add-readme

View Available Branches

git branch

  add-readme
* master

Switch to New Branch

git checkout add-readme

Create & Switch to Branch

git checkout -b add-readme

Create File Named: README.md

touch README.md

Check Repo Status

git status

Add Readme File

git add .

Commit Changes

git commit -m "add readme file"

Push the New Branch

git push origin add-readme

 

With that, we’ve successfully added a README.md file only to the newly created branch “add-readme”.