`do_pick` is the git-cherry-pick wrapper in git-rebase--interactive that is used to implement the to-do list command `pick`, `reword` and `edit`. To cater for the different pick behaviours (like `squash`), `do_pick` accepts several options not only from the git-cherry-pick but also the git-commit interface. Add the option `--file` from the git-commit interface to the options pool of `do_pick`. It expects an argument itself which is interpreted as a file path and takes the commit message from the given file. If `--file` is passed to `do_pick`, assign the given file path to the local variable `rewrite_message` and relay the option --file "$rewrite_message" to the git-commit command line which creates the commit. Signed-off-by: Fabian Ruch <bafain@xxxxxxxxx> --- git-rebase--interactive.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 20a637a..f8be238 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -464,7 +464,7 @@ record_in_rewritten() { # Apply the changes introduced by the given commit to the current head. # -# do_pick [--amend] [--edit] <commit> +# do_pick [--amend] [--file <file>] [--edit] <commit> # # Wrapper around git-cherry-pick. # @@ -474,6 +474,12 @@ record_in_rewritten() { # # _This is not a git-cherry-pick option._ # +# -F <file>, --file <file> +# Take the commit message from the given file. This creates a fresh +# commit. +# +# _This is not a git-cherry-pick option._ +# # -e, --edit # After picking <commit>, open an editor and let the user edit the # commit message. The editor contents becomes the commit message of @@ -492,6 +498,7 @@ do_pick () { rewrite= rewrite_amend= rewrite_edit= + rewrite_message= while test $# -gt 0 do case "$1" in @@ -505,6 +512,16 @@ do_pick () { rewrite_amend=y git rev-parse --verify HEAD >"$amend" ;; + -F|--file) + if test $# -eq 0 + then + warn "do_pick: option --file specified but no <file> given" + return 2 + fi + rewrite=y + rewrite_message=$2 + shift + ;; -e|--edit) rewrite=y rewrite_edit=y @@ -555,6 +572,7 @@ do_pick () { ${allow_empty_message:+--allow-empty-message} \ ${rewrite_amend:+--amend} \ ${rewrite_edit:+--edit --commit-msg} \ + ${rewrite_message:+--file "$rewrite_message"} \ ${gpg_sign_opt:+"$gpg_sign_opt"} || return 3 fi } -- 2.0.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html