Re: Coping commits from one branch to another
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 22, 2008, 16:03 UTC
- Message-ID
- <alpine.LSU.1.00.0801221601570.5731@racer.site>
- In-Reply-To
- <8e04b5820801220745m3736686exf631f31c9e6d785a@mail.gmail.com>
Hi,
On Tue, 22 Jan 2008, Ciprian Dorin Craciun wrote:
Show 25 quoted lines
> Hello all! > > My question is how can I use git-rebase -- or a similar command -- > to actually copy the commits from one branch to another. > > For example I have cloned the linux kernel repository and I have > the following branches: > -- v2.6.22-stable > -- v2.6.23-local > -- v2.6.23-stable > -- v2.6.23-local > > The difference between v2.6.x-stable and v2.6.x-local are just a > few minor patches (which are not in the default kernel tree) and some > script files added to make the compilation and deployment easier for > my setup. Thus v2.6.x-local is an ancestor of v2.6.x-stable. Now when > v2.6.24 will arrive I would like to "copy" the commits from > v2.6.23-local to v2.6.24-local. > > One solution would be to use: > git rebase --onto v2.6.24-local v2.6.23-stable v2.6.23-local > > But this will not copy the commits, but actually move them. (And I > do not see anything about this case in the git rebase documentation, > or pointers to other commands similar to rebase.)
Very easy. Do this before rebasing:
git checkout -b v2.6.24-local v2.6.23-local
then proceed with
git rebase --onto 2.6.24-stable v2.6.23-stable
Hth, Dscho