-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
  • 499
  • 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
  • 290,304
  • 63
  • 469
  • 417
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,803
  • 11
  • 66
  • 93