7

I try to merge two repos, yielding a flat (aka interleaved) history. I do this along the lines of https://stackoverflow.com/a/14839653/188108, under "History rewrite:".

The two branches to merge are in "master" and "src/master". Then, I write:

$ git checkout --orphan new-master
$ git cherry-pick 9d325d6d 3f4c52ba
error: a cherry-pick or revert is already in progress
hint: try "git cherry-pick (--continue | --quit | --abort)"
fatal: cherry-pick failed
$ git cherry-pick 9d325d6d && git cherry-pick 3f4c52ba
[new-master 10f0277] Initial revision.
 7 files changed, 194 insertions(+)
 create mode 100644 __init__.py
 create mode 100644 manage.py
 create mode 100644 samples/__init__.py
 create mode 100644 samples/models.py
 create mode 100644 samples/views.py
 create mode 100644 settings.py
 create mode 100644 urls.py
[new-master 08e083c] Fixed field name in SixChambersLayer.  Added Sample.current_place.
 1 file changed, 2 insertions(+), 1 deletion(-)

So, why does the first cherry pick command fail, but the split command works? I use git 1.9.1.

Community
  • 1
  • 1
Torsten Bronger
  • 9,899
  • 7
  • 34
  • 41
  • I have this same problem but with git 2.8.2. I ended up using `echo sha1 sha1 sha1 | xargs -n1 git cherry-pick` to workaround this problem I don't understand. – Chris Cleeland Nov 10 '16 at 16:22

1 Answers1

1

Try instead:

git cherry-pick 9d325d6d^..3f4c52ba

As I mentioned in "How to cherry pick a range of commits and merge into another branch":

In the "cherry-pick A..B" form, A should be older than B.
If they're the wrong order the command will silently fail.

If you want to pick the range B through D (inclusive) that would be B^..D.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • As explained in the linked SO answer, I have a list of SHA-1s that I need to cherry-pick in order to build a new branch from them. In other words, they are only rarely consecutive. `man 7 gitrevision` suggests that a mere list of commit IDs should work ... Besides, I don't understand the error message of `git cherry-pick`. – Torsten Bronger Aug 24 '14 at 13:41
  • @bronger are you listing those commits in the right order (from the oldest to the newest)? Also on What OS are you? (to check if a more recent git would work better) – VonC Aug 24 '14 at 13:43
  • Yes, it is oldest to newest. And it is Ubuntu 14.04 and its git. – Torsten Bronger Aug 25 '14 at 17:21