11

I've cloned master from my repository and have been making a bunch of edits and local commits. I've now realised this should be a new branch in my remote repository. Normally I'd just push to the remote system, how do I push as a new branch to the remote repos?

new299
  • 804
  • 1
  • 7
  • 17
  • @FelixKling yes it looks like it's a duplicate of that question. I used the suggestion there and it worked perfectly for me, thanks! – new299 Feb 08 '13 at 16:19
  • 1
    @new299 -- Be sure to check Mike Weller's link as well, as you may want to "back up" your master branch to agree with origin/master. My answer basically duplicates the answers given to that question. – chepner Feb 08 '13 at 16:35

1 Answers1

5

Assuming you have't pushed anything yet and your history looks something like

A -- B -- C -- D -- E
^                   ^
|                   |
origin/master       master

You can just do the following:

git branch feature
git reset origin/master

to get this:

A -- B -- C -- D -- E
^                   ^
|                   |
|                   feature
origin/master,master
chepner
  • 497,756
  • 71
  • 530
  • 681