Move commits not in origin to a branch

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

Move commits not in origin to a branch

From: shawn wilson <hidden>
Date: 2016-06-15 23:03:57

How do I move commits I haven't pushed into a new branch?

 % git log origin..master --pretty=format:'%h'
f7d3a19
1f186c9
66d99f6

Which I'd like to be in a new branch.

Re: Move commits not in origin to a branch

From: Michael J Gruber <hidden>
Date: 2016-06-15 23:03:57

shawn wilson venit, vidit, dixit 02.03.2015 14:25:
How do I move commits I haven't pushed into a new branch?

 % git log origin..master --pretty=format:'%h'
f7d3a19
1f186c9
66d99f6

Which I'd like to be in a new branch.
Do you want them to be on the new branch as they are, i.e. as commits
built on top of master? Then

git branch mybranch master

will create a new branch "mybranch" which contains those commits. If you
want to "remove" them from master, then

git checkout master # unless you are there already
git reset --keep origin/master

to "rewind" master to commit "origin/master".

Michael

Re: Move commits not in origin to a branch

From: shawn wilson <hidden>
Date: 2016-06-15 23:03:57

On Mon, Mar 2, 2015 at 9:54 AM, Michael J Gruber
[off-list ref] wrote:
shawn wilson venit, vidit, dixit 02.03.2015 14:25:
quoted
How do I move commits I haven't pushed into a new branch?

 % git log origin..master --pretty=format:'%h'
f7d3a19
1f186c9
66d99f6

Which I'd like to be in a new branch.
Do you want them to be on the new branch as they are, i.e. as commits
built on top of master? Then

git branch mybranch master
Oh cool, I think that's what I wanted. I didn't realize it was that
easy - I said screw it and went and pushed them, but... for next time
(or I'll stop being stupid and work in a branch from now on).

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help