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?
Asked
Active
Viewed 4,373 times
11
-
@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 Answers
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
-
Just as I was going to hit "post" you beat me to it! +1 (Though in retrospect, this is a dup .. but still +1) – Brian Roach Feb 08 '13 at 16:09