push a new local branch to a remote Git repository and track

 


Step1: In Git, you can checkout a new branch:

git checkout -b <branch>

Step2: Edit files, add and commit your changes to github repo.

git add .

git commit -m "Update added"

Step3: Then push on the origin branch using the below command:

git push -u origin <branch>

** -u (short for --set-upstream)

Git will set-up the tracking information during the pushing branch.


To view both remote-tracking branches and local branches, use the below command:

git branch -a

Comments