Re: Need some help with git rebase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 31, 2009 at 10:02:12AM +0100, Sylvain Rabot wrote:
> On Wed, Dec 30, 2009 at 23:46, Wincent Colaiuta <win@xxxxxxxxxxx> wrote:
> >
> > Look at the "git-rebase" man page, particularly the order of the arguments, what they mean, and the usage examples of "--onto":
> >
> >  $ git rebase --onto 12.72.1 master feature
> >
> > Means, "replay these changes on top of 12.72.1", where "these changes" refers to commits on branch "feature" with upstream "master", which is what "git rebase" did for you.
> >
> > If you actually want the "feature" branch to continue pointing at the old feature branch rather than your newly rebased one, you could just look up the old SHA1 for it and update it with:
> >
> >  $ git branch -f feature abcd1234
> >
> > Where "abcd1234" is the hash of the old "feature" HEAD.
> >
> > But I don't really know why you'd want to do that. The purpose of "git rebase" isn't to copy or cherry-pick commits from one branch onto another, but to actually _move_ (or transplant, or replay, if you prefer) those commits.
> >
> > Maybe I misunderstood your intentions though.
> >
> > Cheers,
> > Wincent
> >
> 
> In fact I want to backport the commits of the feature branch into 12.72.1.
> I used git rebase because the drawings of the man page looked like
> that I wanted to do and it does except for the part it resets the head
> of my feature branch.
> 
> But the good behavior would be to cherry pick each commit of the
> feature branch and apply them into 12.72.1, right ?
> 

$ git checkout -b rebased_feature feature
$ git rebase --onto 12.72.1 master rebased_feature

will create a temporary branch named "rebased_feature" pointing to the same
commit as the branch "feature". In fact, this will rebase the commits on the
feature branch not reachable from master onto your 12.72.1 branch *and* won't
reset the feature branch. Instead the temporary branch named "rebased_feature"
will be rebased ontop of 12.72.1.

I would still prefere the rebase over doing multiple cherry picks.

-Peter
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]