N
N
nckma2013-07-30 15:17:17
git
nckma, 2013-07-30 15:17:17

How to push to an uncreated remote branch

Such situation.
I am in the main-branch branch - this is production.
Made a few commits locally, but haven't pushed yet.
Now I realized that it’s impossible to do push, but it’s a pity to lose commits, and I didn’t immediately create a separate experimental branch for them.
How can I now create and place my latest commits on the remote at the same time as the new branch, but so that the main-branch does not change?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2013-07-30
@BuriK666

git push <remote-name> <local-branch-name>:<remote-branch-name>

N
nckma, 2013-07-30
@nckma

thanks, helped:
$ git branch -m <new-branch-name>
$ git push -u origin <new-branch-name>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question