0

Im using gitHub, upto now have a forked repos containg justa local and remote master branch but Im trying to use branches for each issue so that my pull requests only contain the commit I have just pushed rather than all outstanding commits on master.

So on my machine, modify and commit went okay

git checkout -b issue36
vi fix_xml.py
git commit -a -m "#36:Start and end tags no longer added"

but git push did nothing said upto date

So I went to GitHub and created a new remote branch called issue36 (which is assume is based on master) and tried again

git push

And this worked and it pushed the changes to remote branch 36

But is there a way I could have created this remote branch from my local machine instead of having to go into github.

Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
  • possible duplicate of [Git how to create remote branch](http://stackoverflow.com/questions/1519006/git-how-to-create-remote-branch) – Wander Nauta Jun 25 '14 at 11:03

2 Answers2

0

Yep. If you spell out the origin and branch name, like git push origin issue36, Git will create the remote branch for you if it doesn't exist.

Wander Nauta
  • 18,832
  • 1
  • 45
  • 62
  • ok thanks some confusion in the linked question as to whether that command does create remote branch it or not but Ill give it a go. – Paul Taylor Jun 25 '14 at 11:09
0

You can create a remote branch using you local git console by executing the following command:

$git push origin <branch_name>

This will automatically create the branch for you in the github.

Mainul
  • 879
  • 7
  • 10