Thoughts about the -m option of cherry-pick and revert

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

 



There are plenty of StackOverflow questions and blog posts about the
error message that you get when you use git cherry-pick or git revert on
a merge commit without specifying the -m option. Many people don't seem
to understand what the error message means, or why they even get an
error in the first place.

The answers to these questions patiently explain what the error means
and why the -m option is necessary. Many of them contain example
scenarios; but I haven't seen a single one that doesn't use -m1 to
illustrate the usage.

I have two questions:

- What are real-world scenarios where you would use a mainline number
  other than 1? I could only come up with a single example myself, which
  is that you have a topic branch, and right before merging it back to
  main, you merge main into the topic branch; and then you merge it to
  main with a fast-forward merge. If you then want to cherry-pick or
  revert that topic, you'd have to use -m2 on that last merge from main.
  Any other examples?
- Wouldn't it make sense to default to -m1 when no -m option is given?
  It seems that this would do the expected thing in the vast majority of
  cases.

For the GUI client that I'm co-maintaining (lazygit), I'm actually
considering going so far as to not providing a choice at all, and always
using -m1. I'm not fully decided yet if that's a good idea, but it seems
that most people expect this, most of the time.

I'm probably missing something though, but what?

-Stefan




[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]

  Powered by Linux