Push a new Git branch to a remote repo using Git

This article will shows you that how you can  push new Git branches to remote repositories on GitHub, Gitlab, Bitbucket.

Tracking branches are local branches that have a direct relationship to a remote branch. If you're on a tracking branch and type git pull , Git automatically knows which server to fetch from and which branch to merge in.

Follow the following steps to push any branch to remote repository.

  1. Create a new branch using git branch some-branch , and checkout newly created branch using git checkout some-branch
  2. Do some commits in you newly created branch using git commit -m "my first commit in new branch"
  3. Push your new branch with all commits you only need to git push –set-upstream origin some-branch

 

Push a new Git branch to a remote repository with practical example

git checkout master
git branch some-branch
git checkout some-branch
git status
git commit -m "myfirst commmit in new branch"
git push --set-upstream origin some-branch

Tags:

git

Share:

Related posts