I have followed the following steps :
- git pull
- git checkout -b newBranch
- Made changes
Now I want to push this to github but on a new branch "newBranch". How do I do it ?
I have followed the following steps :
Now I want to push this to github but on a new branch "newBranch". How do I do it ?
First, you have to commit your changes:
git status
git add -- <files>
git commit -m "Commit message"
You then have to git push
:
git push -u origin newBranch
-u
will set the upstream for your new branch so that you can do git push
, git pull
etc in the future without having to say where to / from.
git push origin newBranch
will do the trick. Any time you need to push code, it's git push [name of remote repository] [name of branch]
. in this case, the name of your remote is origin, and your branch is newBranch