I am on a master branch 'master' and I have 1 commit ahead I want to create a new remote branch called 'new_remote' and push my commit there?
$ git branch
* master
$ git remote
old_remote
$ git status
# On branch master
# Your branch is ahead of 'old_remote/master' by 1 commit.
I want to push my commit to a new branch on remote called 'new remote' Thank you.
To push to a specific branch in Git, open Git Bash and navigate to the directory from which you want to push files to the remote branch. Then, initialize the directory using the “$ git init” command. Next, run the “$ git add .” command to add all files.
If you are currently working on local branch master, and the new remote branch has not been created yet:
git checkout -b new_branch // creates a local branch (as a copy of the current)
git push origin new_branch // push it to the remote server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With