From: Jakub Narebski <jnareb@gmail.com>
To: Howard Miller <howard@e-learndesign.co.uk>
Cc: git@vger.kernel.org
Subject: Re: Created branch in wrong place... how to fix?
Date: Thu, 2 Jun 2011 08:28:59 +0200 [thread overview]
Message-ID: <201106020829.01063.jnareb@gmail.com> (raw)
In-Reply-To: <BANLkTiktYkvGqc9Wq51-QMKe2kHzcmGXRQ@mail.gmail.com>
Howard Miller wrote:
> > > 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>
>
> Thanks.... I've re-read the rebase help and spotted the appropriate
> example. This makes sense.
>
> The only thing that I'm a little bit unsure of is what does 'upstream'
> actually mean (used in the help quite liberally)? Does it just mean an
> older ancestor of the current HEAD? I was struggling to find a definition.
gitglossary(7) has the following definition:
upstream branch::
The default branch that is merged into the branch in question
(or the branch in question is rebased onto). It is configured
via `branch.<name>.remote` and `branch.<name>.merge`. If the
upstream branch of 'A' is 'origin/B' sometimes we say
"'A' is tracking 'origin/B'"
But in the case of rebase "upstream" means branch you forked from (you
created branch from).
N.B. if the branch in question is not too old, you can examine its
reflog ('git log -g <branch>' or 'git reflog show <branch>') for a creation
event, e.g.:
2de58b3 gitweb/doc@{24}: branch: Created from origin
--
Jakub Narebski
Poland
prev parent reply other threads:[~2011-06-02 6:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201106020829.01063.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=howard@e-learndesign.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).