-2

I have followed the following steps :

  1. git pull
  2. git checkout -b newBranch
  3. Made changes

Now I want to push this to github but on a new branch "newBranch". How do I do it ?

Santosh Pashupati
  • 479
  • 1
  • 6
  • 16

2 Answers2

0

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.

manojlds
  • 275,671
  • 58
  • 453
  • 409
0

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

msanford
  • 11,125
  • 10
  • 64
  • 87