* Created branch in wrong place... how to fix?
@ 2011-06-01 12:47 Howard Miller
2011-06-01 12:52 ` Tim Guirgies
2011-06-01 13:32 ` Jakub Narebski
0 siblings, 2 replies; 4+ messages in thread
From: Howard Miller @ 2011-06-01 12:47 UTC (permalink / raw)
To: git
Hi,
I created a branch in a project and did a series of commits. I now
discover that I really wanted to make all those changes against a
completely different branch of the same project. There shouldn't be
any issues as the branch introduces entirely new files (no changes to
existing code).
I'm struggling to see a way to do this without loosing the history.
Some Google'ing suggests 'rebase --onto' but I'm struggling to see how
this works or if it is appropriate. Any pointers much appreciated :)
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Created branch in wrong place... how to fix?
2011-06-01 12:47 Created branch in wrong place... how to fix? Howard Miller
@ 2011-06-01 12:52 ` Tim Guirgies
2011-06-01 13:32 ` Jakub Narebski
1 sibling, 0 replies; 4+ messages in thread
From: Tim Guirgies @ 2011-06-01 12:52 UTC (permalink / raw)
To: Howard Miller; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]
On Wed, Jun 01, 2011 at 01:47:12PM +0100, Howard Miller wrote:
> Hi,
> I created a branch in a project and did a series of commits. I now
> discover that I really wanted to make all those changes against a
> completely different branch of the same project. There shouldn't be
> any issues as the branch introduces entirely new files (no changes to
> existing code).
> I'm struggling to see a way to do this without loosing the history.
> Some Google'ing suggests 'rebase --onto' but I'm struggling to see how
> this works or if it is appropriate. Any pointers much appreciated :)
> Thanks.
"git rebase" is indeed what you want to do. Simply put, it takes all
your commits and rebases them somewhere else; i.e., makes them sit on
top of a different commit. See "git help rebase" for a more detailed
explanation.
Of course, if you've already pushed and people have pulled from you,
you'll have problems; see the "recovering from upstream rebase" section
in "git help rebase".
You'll also want to do "git rebase -i". The "-i" option ensures that
you can review what commits will be rebased, and even rearange, leave
out, or edit commits.
Good luck.
--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Created branch in wrong place... how to fix?
2011-06-01 12:47 Created branch in wrong place... how to fix? Howard Miller
2011-06-01 12:52 ` Tim Guirgies
@ 2011-06-01 13:32 ` Jakub Narebski
[not found] ` <BANLkTiktYkvGqc9Wq51-QMKe2kHzcmGXRQ@mail.gmail.com>
1 sibling, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2011-06-01 13:32 UTC (permalink / raw)
To: Howard Miller; +Cc: git
Howard Miller <howard@e-learndesign.co.uk> writes:
> I created a branch in a project and did a series of commits. I now
> discover that I really wanted to make all those changes against a
> completely different branch of the same project. There shouldn't be
> any issues as the branch introduces entirely new files (no changes to
> existing code).
>
> I'm struggling to see a way to do this without loosing the history.
> Some Google'ing suggests 'rebase --onto' but I'm struggling to see how
> this works or if it is appropriate. Any pointers much appreciated :)
> Thanks.
This is decidely work for git rebase:
$ git rebase --onto <where it should be based> <where it is based> <branch>
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-02 6:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-01 12:47 Created branch in wrong place... how to fix? Howard Miller
2011-06-01 12:52 ` Tim Guirgies
2011-06-01 13:32 ` Jakub Narebski
[not found] ` <BANLkTiktYkvGqc9Wq51-QMKe2kHzcmGXRQ@mail.gmail.com>
2011-06-02 6:28 ` Jakub Narebski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).