From: Miles Bader <hidden> Date: 2016-06-15 22:45:36
Is there any easy way to cherry pick a _range_ of commits from some other
branch to the current branch, instead of just one?
I thought maybe git-rebase could be coerced to do this somehow, but I
couldn't figure a way. [Using git-rebase would be nice because of all the
useful tools it provides, e.g., the --abort, --continue, and -i options.]
Thanks,
-Miles
--
P.S. All information contained in the above letter is false,
for reasons of military security.
From: Deskin Miller <hidden> Date: 2016-06-15 22:45:36
On Thu, Nov 06, 2008 at 11:45:27AM +0900, Miles Bader wrote:
Is there any easy way to cherry pick a _range_ of commits from some other
branch to the current branch, instead of just one?
I thought maybe git-rebase could be coerced to do this somehow, but I
couldn't figure a way.
Rebase is exactly what you want. Given something like this:
o--o--o--A--B--C--o--o--X
\
o--o--D
where you want A, B, C to go on top of D:
$ git checkout -b newbranch C
$ git rebase --onto D ^A
newbranch will have <...> --D--A--B--C
Hope that helps,
Deskin Miller
From: Björn Steinbrink <hidden> Date: 2016-06-15 22:45:36
On 2008.11.05 22:24:37 -0500, Deskin Miller wrote:
On Thu, Nov 06, 2008 at 11:45:27AM +0900, Miles Bader wrote:
quoted
Is there any easy way to cherry pick a _range_ of commits from some other
branch to the current branch, instead of just one?
I thought maybe git-rebase could be coerced to do this somehow, but I
couldn't figure a way.
Rebase is exactly what you want. Given something like this:
o--o--o--A--B--C--o--o--X
\
o--o--D
where you want A, B, C to go on top of D:
$ git checkout -b newbranch C
$ git rebase --onto D ^A
That should be A^ ;-)
newbranch will have <...> --D--A--B--C
... and then you can merge newbranch into the existing branch that
references D, fast-forwarding the branch. And then newbranch can be
deleted.
If you don't want to use a temporary branch, you can also do (while on
the branch onto which you want to cherry-pick):
git reset --hard C
git rebase --onto ORIG_HEAD A^
Which should get you the same result, without using a temporary branch.
Björn
From: Alex Riesen <hidden> Date: 2016-06-15 22:45:36
Miles Bader, Thu, Nov 06, 2008 03:45:27 +0100:
Is there any easy way to cherry pick a _range_ of commits from some other
branch to the current branch, instead of just one?
I thought maybe git-rebase could be coerced to do this somehow, but I
couldn't figure a way. [Using git-rebase would be nice because of all the
useful tools it provides, e.g., the --abort, --continue, and -i options.]
git format-patch --full-index --binary --stdout <range...> | git am -3
This will not work if you want to pick a list, not a range, of
commits.
git format-patch --full-index --binary --stdout <range...> | git am -3
This will not work if you want to pick a list, not a range, of
commits.
Doesn't "--no-walk" + list commits individually work?
So it _should_ be possible to pick a list of commits too. Although I think
that git format-patch will reverse the order.
Linus
From: Miles Bader <hidden> Date: 2016-06-15 22:45:37
quoted
git format-patch --full-index --binary --stdout <range...> | git am -3
This will not work if you want to pick a list, not a range, of
commits.
Doesn't "--no-walk" + list commits individually work?
So it _should_ be possible to pick a list of commits too. Although I think
that git format-patch will reverse the order.
Incidentally, the reason I like a rebase-based solution is that many
of the rebase features like -i, --abort, and --continue (after
conflict resolution) are very nice for the multi-cherry-pick case too,
and I'm already very familiar with their operation from using rebase.
[git-am seems to have some similar features, but I don't know how well
they work.]
-Miles
--
Do not taunt Happy Fun Ball.