git cherry-pick -x default
Asked Answered
N

2

25

In the man page for git cherry-pick:

...

-x
    When recording the commit, append a line that says "(cherry picked
    from commit …)" to the original commit message in order to indicate
    which commit this change was cherry-picked from. ...

-r
    It used to be that the command defaulted to do -x described above,
    and -r was to disable it. Now the default is not to do -x so this
    option is a no-op.

...

Is there a config setting to locally set the default back to -x, and allow -r to disable it? I couldn't find one, but I may have missed it.

Niehaus answered 22/6, 2012 at 14:36 Comment(0)
N
18

Short of making an alias for git cherry-pick -x, no, this is not possible.

(Fun fact: The default was changed in commit abd6970.)

Niehaus answered 25/6, 2012 at 20:10 Comment(1)
The detail about private commits was my "ah-ha!" moment. Thanks for the link to the commit that explained it.Dioscuri
A
5

add this alias to your ~/.gitconfig by running:

git config --global --replace-all alias.pick "cherry-pick -x"

You can then simply run:

git pick abc123

You may replace the choice of "pick" to whatever word makes sense to you.

Alaster answered 9/12, 2021 at 17:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.