commit doc: document that -c, -C, -F and --fixup with -m error
PATCH v2 1/2 commit doc: document that -c, -C, -F and --fixup with -m error
Document that providing any of -c, -C, -F and --fixup along with -m will result in an error. Some variant of this has been errored about explicitly since 0c091296c0 ("git-commit: log parameter updates.", 2005-08-08), but the documentation was never updated to reflect this.
--- Documentation/git-commit.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/git-commit.txt +3 -0
@@ -144,6 +144,9 @@ OPTIONS Use the given <msg> as the commit message. If multiple `-m` options are given, their values are concatenated as separate paragraphs. ++ +Combining the `-m` option and any of `-c`, `-C`, `-F` or `--fixup` +will result in an error. -t <file>:: --template=<file>::
Signature · 1 line
2.15.1.424.g9478a66081
PATCH v2 2/2 commit: add support for --fixup <commit> -m"<extra message>"
Add support for supplying the -m option with --fixup. Doing so has errored out ever since --fixup was introduced. Before this, the only way to amend the fixup message while committing was to use --edit and amend it in the editor.
The use-case for this feature is one of:
* Leaving a quick note to self when creating a --fixup commit when it's not self-evident why the commit should be squashed without a note into another one.
* (Ab)using the --fixup feature to "fix up" commits that have already been pushed to a branch that doesn't allow non-fast-forwards, i.e. just noting "this should have been part of that other commit", and if the history ever got rewritten in the future the two should be combined.
In such a case you might want to leave a small message, e.g. "forgot this part, which broke XYZ".
When the --fixup option was initially added the "Option -m cannot be combined" error was expanded from -c, -C and -F to also include --fixup[1]
Those options could also support combining with -m, but given what they do I can't think of a good use-case for doing that, so I have not made the more invasive change of splitting up the logic in commit.c to first act on those, and then on -m options.
1. d71b8ba7c9 ("commit: --fixup option for use with rebase --autosquash", 2010-11-02)
--- Documentation/git-commit.txt | 4 ++-- builtin/commit.c | 8 +++++--- t/t7500-commit.sh | 9 ++++++++- 3 files changed, 15 insertions(+), 6 deletions(-)
Documentation/git-commit.txt +2 -2
@@ -145,8 +145,8 @@ OPTIONS If multiple `-m` options are given, their values are concatenated as separate paragraphs. + -Combining the `-m` option and any of `-c`, `-C`, `-F` or `--fixup` -will result in an error. +Combining the `-m` option and any of `-c`, `-C` or `-F` will result in +an error. -t <file>:: --template=<file>::
builtin/commit.c +5 -3
@@ -701,7 +701,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, } } -if (have_option_m) { +if (have_option_m && !fixup_message) {strbuf_addbuf (&sb, &message); hook_arg1 ="message" ; }else if (logfile && !strcmp (logfile,"-" )) {
@@ -731,6 +731,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix, ctx.output_encoding =get_commit_output_encoding ();format_commit_message (commit,"fixup! %s\n\n" , &sb, &ctx); +if (have_option_m) +strbuf_addbuf (&sb, &message); hook_arg1 ="message" ; }else if (!stat (git_path_merge_msg (), &statbuf)) {/*
@@ -1197,8 +1199,8 @@ static int parse_and_validate_options(int argc, const char *argv[], f++;if (f >1 )die (_ ("Only one of -c/-C/-F/--fixup can be used." )); -if (have_option_m && f >0 ) -die ((_ ("Option -m cannot be combined with -c/-C/-F/--fixup." ))); +if (have_option_m && (edit_message || use_message || logfile)) +die ((_ ("Option -m cannot be combined with -c/-C/-F." )));if (f || have_option_m) template_file =NULL ;if (edit_message)
t/t7500-commit.sh +8 -1
@@ -272,6 +272,14 @@ test_expect_success 'commit --fixup provides correct one-line commit message' ' commit_msg_is "fixup! target message subject line" ' +test_expect_success 'commit --fixup -m"something" -m"extra"' ' + commit_for_rebase_autosquash_setup && + git commit --fixup HEAD~1 -m"something" -m"extra" && + commit_msg_is "fixup! target message subject linesomething + +extra" +' + test_expect_success 'commit --squash works with -F' ' commit_for_rebase_autosquash_setup && echo "log message from file" >msgfile &&
@@ -325,7 +333,6 @@ test_expect_success 'invalid message options when using --fixup' ' test_must_fail git commit --fixup HEAD~1 --squash HEAD~2 && test_must_fail git commit --fixup HEAD~1 -C HEAD~2 && test_must_fail git commit --fixup HEAD~1 -c HEAD~2 && - test_must_fail git commit --fixup HEAD~1 -m "cmdline message" && test_must_fail git commit --fixup HEAD~1 -F log '
Signature · 1 line
2.15.1.424.g9478a66081
Re: [PATCH 2/2] commit: add support for --fixup <commit> -m"<extra message>"
Quoted 4 lines · Ævar Arnfjörð Bjarmason
Add support for supplying the -m option with --fixup. Doing so has errored out ever since --fixup was introduced. Before this, the only way to amend the fixup message while committing was to use --edit and amend it in the editor.
I can't tell, based upon this description, if '-m<msg> --edit' is a valid combination and, if so, does it correctly open the editor after appending <msg>?
Quoted 4 lines
Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
t/t7500-commit.sh test_expect_success 'commit --fixup provides correct one-line commit message' ' · line 281
Quoted 10 lines
t/t7500-commit.sh +7
-0@@ -272,6 +272,14 @@ test_expect_success 'commit --fixup provides correct one-line commit message' ' commit_msg_is "fixup! target message subject line" ' +test_expect_success 'commit --fixup -m"something" -m"extra"' ' + commit_for_rebase_autosquash_setup && + git commit --fixup HEAD~1 -m"something" -m"extra" && + commit_msg_is "fixup! target message subject linesomething + +extra" +'
Hmm, so the first -m appended to the "fixup!" line, but the second -m appended after a blank line? That doesn't seem very intuitive.
Also, doesn't the text following "fixup!" need to exactly match the summary line of the commit message in order for "git rebase -i --autosquash" to work? Am I overlooking something obvious?
Re: [PATCH 2/2] commit: add support for --fixup <commit> -m"<extra message>"
On Wed, Dec 20 2017, Eric Sunshine jotted:
Quoted 10 lines
Quoted 4 lines · Ævar Arnfjörð Bjarmason
Add support for supplying the -m option with --fixup. Doing so has errored out ever since --fixup was introduced. Before this, the only way to amend the fixup message while committing was to use --edit and amend it in the editor.
I can't tell, based upon this description, if '-m<msg> --edit' is a valid combination and, if so, does it correctly open the editor after appending <msg>?
Yes, that's works as expected for all the options, and this doesn't break that.
Quoted 18 lines
Quoted 4 lines
Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
t/t7500-commit.sh test_expect_success 'commit --fixup provides correct one-line commit message' ' · line 281
Quoted 10 lines
t/t7500-commit.sh +7
-0@@ -272,6 +272,14 @@ test_expect_success 'commit --fixup provides correct one-line commit message' ' commit_msg_is "fixup! target message subject line" ' +test_expect_success 'commit --fixup -m"something" -m"extra"' ' + commit_for_rebase_autosquash_setup && + git commit --fixup HEAD~1 -m"something" -m"extra" && + commit_msg_is "fixup! target message subject linesomething + +extra" +'Hmm, so the first -m appended to the "fixup!" line, but the second -m appended after a blank line? That doesn't seem very intuitive.
Quoted 3 lines
Also, doesn't the text following "fixup!" need to exactly match the summary line of the commit message in order for "git rebase -i --autosquash" to work? Am I overlooking something obvious?
It does the right thing and it's actually "$fixup_line\n\n$first_m\n\n$second_m" etc. It's just that this commit_msg_is function is testing against the "%s%b" format, so the first line of the body comes right after the subject.
Thanks for the review of both patches. I'll clarify the points raised in commit message for v2 pending further feedback.
Re: [PATCH 2/2] commit: add support for --fixup <commit> -m"<extra message>"
Quoted 14 lines · Ævar Arnfjörð Bjarmason
On Wed, Dec 20 2017, Eric Sunshine jotted:
Quoted 13 lines
t/t7500-commit.sh test_expect_success 'commit --fixup provides correct one-line commit message' ' · line 281
Quoted 7 lines · Ævar Arnfjörð Bjarmason
t/t7500-commit.sh +7
-0+test_expect_success 'commit --fixup -m"something" -m"extra"' ' + commit_for_rebase_autosquash_setup && + git commit --fixup HEAD~1 -m"something" -m"extra" && + commit_msg_is "fixup! target message subject linesomething + +extra" +'Hmm, so the first -m appended to the "fixup!" line, but the second -m appended after a blank line? That doesn't seem very intuitive.
Quoted 8 lines
Quoted 3 lines
Also, doesn't the text following "fixup!" need to exactly match the summary line of the commit message in order for "git rebase -i --autosquash" to work? Am I overlooking something obvious?
It does the right thing and it's actually "$fixup_line\n\n$first_m\n\n$second_m" etc. It's just that this
commit_msg_isfunction is testing against the "%s%b" format, so the first line of the body comes right after the subject.
Thanks for explaining. I guess I should have delved into commit_msg_is() before commenting.
v2 cover support -m"<msg>" combined with commit --fixup
Here's a hopefully ready to apply v2 incorporating feedback from Eric (thanks!). A tbdiff with v1 follows below.
Ævar Arnfjörð Bjarmason (2):
commit doc: document that -c, -C, -F and --fixup with -m error
commit: add support for --fixup <commit> -m"<extra message>"
Documentation/git-commit.txt | 2 ++ builtin/commit.c | 8 +++++--- t/t7500-commit.sh | 9 ++++++++- 3 files changed, 15 insertions(+), 4 deletions(-)
1: 7d5e2531ee ! 1: 82333992ec commit doc: document that -c, -C, -F and --fixup with -m error
@@ -7,6 +7,7 @@
explicitly since 0c091296c0 ("git-commit: log parameter updates.",
2005-08-08), but the documentation was never updated to reflect this.
+ Wording-by: Eric Sunshine <[email protected]>
Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]>
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
@@ -17,8 +18,8 @@
If multiple `-m` options are given, their values are
concatenated as separate paragraphs.
++
-+Combining the `-m` option and any of `-c`, `-C`, `-F` or `--fixup`
-+will result in an error.
++The `-m` option is mutually exclusive with `-c`, `-C`, `-F`, and
++`--fixup`.
-t <file>::
--template=<file>::2: bd78a211ed ! 2: 780de6e042 commit: add support for --fixup <commit> -m"<extra message>"
@@ -22,6 +22,21 @@
In such a case you might want to leave a small message,
e.g. "forgot this part, which broke XYZ".
+ With this, --fixup <commit> -m"More" -m"Details" will result in a
+ commit message like:
+
+ !fixup <subject of <commit>>
+
+ More
+
+ Details
+
+ The reason the test being added here seems to squash "More" at the end
+ of the subject line of the commit being fixed up is because the test
+ code is using "%s%b" so the body immediately follows the subject, it's
+ not a bug in this code, and other tests t7500-commit.sh do the same
+ thing.
+
When the --fixup option was initially added the "Option -m cannot be combined" error was expanded from -c, -C and -F to also include --fixup[1]
@@ -34,6 +49,7 @@
1. d71b8ba7c9 ("commit: --fixup option for use with rebase --autosquash", 2010-11-02)
+ Helped-by: Eric Sunshine <[email protected]>
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
@@ -43,10 +59,9 @@
If multiple -m options are given, their values are concatenated as separate paragraphs.
+
--Combining the -m option and any of -c, -C, -F or --fixup --will result in an error.
-+Combining the -m option and any of -c, -C or -F will result in -+an error.
+-The -m option is mutually exclusive with -c, -C, -F, and +---fixup.
++The -m option is mutually exclusive with -c, -C, and -F.
-t <file>::
--template=<file>::
Signature · 1 line
2.15.1.424.g9478a66081
PATCH v2 1/2 commit doc: document that -c, -C, -F and --fixup with -m error
Document that providing any of -c, -C, -F and --fixup along with -m will result in an error. Some variant of this has been errored about explicitly since 0c091296c0 ("git-commit: log parameter updates.", 2005-08-08), but the documentation was never updated to reflect this.
--- Documentation/git-commit.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/git-commit.txt +3 -0
@@ -144,6 +144,9 @@ OPTIONS Use the given <msg> as the commit message. If multiple `-m` options are given, their values are concatenated as separate paragraphs. ++ +The `-m` option is mutually exclusive with `-c`, `-C`, `-F`, and +`--fixup`. -t <file>:: --template=<file>::
Signature · 1 line
2.15.1.424.g9478a66081
Re: [PATCH v2 0/2] support -m"<msg>" combined with commit --fixup
In reply to Ævar Arnfjörð BjarmasonQuoted 6 lines · Ævar Arnfjörð Bjarmason
Here's a hopefully ready to apply v2 incorporating feedback from Eric (thanks!). A tbdiff with v1 follows below.
Ævar Arnfjörð Bjarmason (2):
commit doc: document that -c, -C, -F and --fixup with -m error
commit: add support for --fixup <commit> -m"<extra message>"
Patch 2/2 doesn't seem to have made it to the list...
Quoted 5 lines
2:
bd78a211ed! 2:780de6e042commit: add support for --fixup <commit> -m"<extra message>"
@@ -22,6 +22,21 @@
In such a case you might want to leave a small message,
e.g. "forgot this part, which broke XYZ".
Quoted 14 lines
+ With this, --fixup <commit> -m"More" -m"Details" will result in a
+ commit message like:
+
+ !fixup <subject of <commit>>
+
+ More
+
+ Details
+
+ The reason the test being added here seems to squash "More" at the end
+ of the subject line of the commit being fixed up is because the test
+ code is using "%s%b" so the body immediately follows the subject, it's
+ not a bug in this code, and other testst7500-commit.shdo the same
+ thing.
Did you also intend to mention something about --edit still working with -m? (Or do we assume that people will understand automatically that it does?)
Re: [PATCH v2 0/2] support -m"<msg>" combined with commit --fixup
On Fri, Dec 22 2017, Eric Sunshine jotted:
Quoted 10 lines
Quoted 6 lines · Ævar Arnfjörð Bjarmason
Here's a hopefully ready to apply v2 incorporating feedback from Eric (thanks!). A tbdiff with v1 follows below.
Ævar Arnfjörð Bjarmason (2):
commit doc: document that -c, -C, -F and --fixup with -m error
commit: add support for --fixup <commit> -m"<extra message>"Patch 2/2 doesn't seem to have made it to the list...
Oops, here it comes.
Quoted 20 lines
Quoted 5 lines
2:
bd78a211ed! 2:780de6e042commit: add support for --fixup <commit> -m"<extra message>"
@@ -22,6 +22,21 @@
In such a case you might want to leave a small message,
e.g. "forgot this part, which broke XYZ".Quoted 14 lines
+ With this, --fixup <commit> -m"More" -m"Details" will result in a
+ commit message like:
+
+ !fixup <subject of <commit>>
+
+ More
+
+ Details
+
+ The reason the test being added here seems to squash "More" at the end
+ of the subject line of the commit being fixed up is because the test
+ code is using "%s%b" so the body immediately follows the subject, it's
+ not a bug in this code, and other testst7500-commit.shdo the same
+ thing.
Quoted 3 lines
Did you also intend to mention something about --edit still working with -m? (Or do we assume that people will understand automatically that it does?)
I thought it was clear enough since it works with --fixup now and with everything else, and the commit message was already getting long enough...
PATCH v2 2/2 commit: add support for --fixup <commit> -m"<extra message>"
In reply to Eric SunshineAdd support for supplying the -m option with --fixup. Doing so has errored out ever since --fixup was introduced. Before this, the only way to amend the fixup message while committing was to use --edit and amend it in the editor.
The use-case for this feature is one of:
* Leaving a quick note to self when creating a --fixup commit when it's not self-evident why the commit should be squashed without a note into another one.
* (Ab)using the --fixup feature to "fix up" commits that have already been pushed to a branch that doesn't allow non-fast-forwards, i.e. just noting "this should have been part of that other commit", and if the history ever got rewritten in the future the two should be combined.
In such a case you might want to leave a small message, e.g. "forgot this part, which broke XYZ".
With this, --fixup <commit> -m"More" -m"Details" will result in a commit message like:
!fixup <subject of <commit>>
More
Details
The reason the test being added here seems to squash "More" at the end of the subject line of the commit being fixed up is because the test code is using "%s%b" so the body immediately follows the subject, it's not a bug in this code, and other tests t7500-commit.sh do the same thing.
When the --fixup option was initially added the "Option -m cannot be combined" error was expanded from -c, -C and -F to also include --fixup[1]
Those options could also support combining with -m, but given what they do I can't think of a good use-case for doing that, so I have not made the more invasive change of splitting up the logic in commit.c to first act on those, and then on -m options.
1. d71b8ba7c9 ("commit: --fixup option for use with rebase --autosquash", 2010-11-02)
--- Documentation/git-commit.txt | 3 +-- builtin/commit.c | 8 +++++--- t/t7500-commit.sh | 9 ++++++++- 3 files changed, 14 insertions(+), 6 deletions(-)
Documentation/git-commit.txt +1 -2
@@ -145,8 +145,7 @@ OPTIONS If multiple `-m` options are given, their values are concatenated as separate paragraphs. + -The `-m` option is mutually exclusive with `-c`, `-C`, `-F`, and -`--fixup`. +The `-m` option is mutually exclusive with `-c`, `-C`, and `-F`. -t <file>:: --template=<file>::
builtin/commit.c +5 -3
@@ -701,7 +701,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, } } -if (have_option_m) { +if (have_option_m && !fixup_message) {strbuf_addbuf (&sb, &message); hook_arg1 ="message" ; }else if (logfile && !strcmp (logfile,"-" )) {
@@ -731,6 +731,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix, ctx.output_encoding =get_commit_output_encoding ();format_commit_message (commit,"fixup! %s\n\n" , &sb, &ctx); +if (have_option_m) +strbuf_addbuf (&sb, &message); hook_arg1 ="message" ; }else if (!stat (git_path_merge_msg (), &statbuf)) {/*
@@ -1197,8 +1199,8 @@ static int parse_and_validate_options(int argc, const char *argv[], f++;if (f >1 )die (_ ("Only one of -c/-C/-F/--fixup can be used." )); -if (have_option_m && f >0 ) -die ((_ ("Option -m cannot be combined with -c/-C/-F/--fixup." ))); +if (have_option_m && (edit_message || use_message || logfile)) +die ((_ ("Option -m cannot be combined with -c/-C/-F." )));if (f || have_option_m) template_file =NULL ;if (edit_message)
t/t7500-commit.sh +8 -1
@@ -272,6 +272,14 @@ test_expect_success 'commit --fixup provides correct one-line commit message' ' commit_msg_is "fixup! target message subject line" ' +test_expect_success 'commit --fixup -m"something" -m"extra"' ' + commit_for_rebase_autosquash_setup && + git commit --fixup HEAD~1 -m"something" -m"extra" && + commit_msg_is "fixup! target message subject linesomething + +extra" +' + test_expect_success 'commit --squash works with -F' ' commit_for_rebase_autosquash_setup && echo "log message from file" >msgfile &&
@@ -325,7 +333,6 @@ test_expect_success 'invalid message options when using --fixup' ' test_must_fail git commit --fixup HEAD~1 --squash HEAD~2 && test_must_fail git commit --fixup HEAD~1 -C HEAD~2 && test_must_fail git commit --fixup HEAD~1 -c HEAD~2 && - test_must_fail git commit --fixup HEAD~1 -m "cmdline message" && test_must_fail git commit --fixup HEAD~1 -F log '
Signature · 1 line
2.15.1.424.g9478a66081
Re: [PATCH v2 2/2] commit: add support for --fixup <commit> -m"<extra message>"
Quoted 7 lines · Ævar Arnfjörð Bjarmason
Those options could also support combining with -m, but given what they do I can't think of a good use-case for doing that, so I have not made the more invasive change of splitting up the logic in
commit.cto first act on those, and then on -m options.1.
d71b8ba7c9("commit: --fixup option for use with rebase --autosquash", 2010-11-02)
To be fair, when "rebase --autosquash -i" is run (which is why you would use --fixup in the first place), the log message of the fixup one is used only for locating which one is to be corrected, and the contents of the log message is discarded. So "given what it does", I can't think of a good use-case for using --fixup and -m together, either. So "nobody immediately thought of it when it was added" is certainly not a reason to later make the combination possible.
But I personally am moderately negative on one of these two imagined use cases.
Quoted 10 lines
Add support for supplying the -m option with --fixup. Doing so has errored out ever since --fixup was introduced. Before this, the only way to amend the fixup message while committing was to use --edit and amend it in the editor.
The use-case for this feature is one of:
* Leaving a quick note to self when creating a --fixup commit when it's not self-evident why the commit should be squashed without a note into another one.
This is probably OK.
Quoted 5 lines
* (Ab)using the --fixup feature to "fix up" commits that have already been pushed to a branch that doesn't allow non-fast-forwards, i.e. just noting "this should have been part of that other commit", and if the history ever got rewritten in the future the two should be combined.
This has a smell of the tail wagging the dog.
Perhaps your editor does not have a good integration with external commands to allow you to insert a single-liner output from
git show --date=short -s --pretty='format:%h ("%s", %ad)' "$1"and that is what you are abusing --fixup for?
It is simply bad practice to leave a log entry that begins with !fixup marker that would confuse automated tools like "rebase -i" machinery on a commit that you have no intention of squashing into another, as it invites mistakes.
I do agree with the scenario where you would wish you could take back an earlier mistake but you cannot. But the log for such a follow-up fix should be written just like any other follow-up fix commit, i.e. describe what was wrong and how the wrongness is corrected with the follow-up change. What was wrong in "which commit" is of course important part, but it is a relatively small part.
Re: [PATCH v2 2/2] commit: add support for --fixup <commit> -m"<extra message>"
Quoted 2 lines · Junio C Hamano
... So "nobody immediately thought of it when it was added" is certainly not a reason to later make the combination possible.
Oops, not a reason to later "_not_ to" make an update, of course.
Re: [PATCH v2 2/2] commit: add support for --fixup <commit> -m"<extra message>"
In reply to Junio C HamanoOn Fri, Dec 22 2017, Junio C. Hamano jotted:
Quoted 40 lines
Quoted 7 lines · Ævar Arnfjörð Bjarmason
Those options could also support combining with -m, but given what they do I can't think of a good use-case for doing that, so I have not made the more invasive change of splitting up the logic in
commit.cto first act on those, and then on -m options.1.
d71b8ba7c9("commit: --fixup option for use with rebase --autosquash", 2010-11-02)To be fair, when "rebase --autosquash -i" is run (which is why you would use --fixup in the first place), the log message of the fixup one is used only for locating which one is to be corrected, and the contents of the log message is discarded. So "given what it does", I can't think of a good use-case for using --fixup and -m together, either. So "nobody immediately thought of it when it was added" is certainly not a reason to later make the combination possible.
But I personally am moderately negative on one of these two imagined use cases.
Quoted 10 lines
Add support for supplying the -m option with --fixup. Doing so has errored out ever since --fixup was introduced. Before this, the only way to amend the fixup message while committing was to use --edit and amend it in the editor.
The use-case for this feature is one of:
* Leaving a quick note to self when creating a --fixup commit when it's not self-evident why the commit should be squashed without a note into another one.
This is probably OK.
Quoted 5 lines
* (Ab)using the --fixup feature to "fix up" commits that have already been pushed to a branch that doesn't allow non-fast-forwards, i.e. just noting "this should have been part of that other commit", and if the history ever got rewritten in the future the two should be combined.
Quoted 6 lines
This has a smell of the tail wagging the dog.
Perhaps your editor does not have a good integration with external commands to allow you to insert a single-liner output from
git show --date=short -s --pretty='format:%h ("%s", %ad)' "$1"
Since this use-case is talking about pushing a fixup for an already pushed commit, this is the first thing I put in -m"..." to reduce ambiguity.
Quoted 6 lines
and that is what you are abusing --fixup for?
It is simply bad practice to leave a log entry that begins with !fixup marker that would confuse automated tools like "rebase -i" machinery on a commit that you have no intention of squashing into another, as it invites mistakes.
"if the history ever got rewritten in the future the two should be combined"
So it's still the intent to squash these, it's just not being done right now, and even if it never happens it'll be easy to glance at the relevant commits in log --oneline.
Quoted 7 lines
I do agree with the scenario where you would wish you could take back an earlier mistake but you cannot. But the log for such a follow-up fix should be written just like any other follow-up fix commit, i.e. describe what was wrong and how the wrongness is corrected with the follow-up change. What was wrong in "which commit" is of course important part, but it is a relatively small part.
I don't agree that git as a tool should be so opinionated. You can edit these --fixup messages right now with --edit, and I do. That it doesn't work with -m"" as it should is a longstanding UI wart.
Tools should be naturally composable without needless arbitrary limitations.
Re: [PATCH v2 2/2] commit: add support for --fixup <commit> -m"<extra message>"
Quoted 3 lines · Ævar Arnfjörð Bjarmason
I don't agree that git as a tool should be so opinionated. You can edit these --fixup messages right now with --edit, and I do. That it doesn't work with -m"" as it should is a longstanding UI wart.
I think you missed the point.
I was expressing my opinion, not an opinion of Git as a tool, that I think one of these two "use case" scenario was a bad way not to be encouraged.
That is totally different from allowing --fixup and -m working together. That is a good thing that helps the other "good" use case.
Re: [PATCH v2 2/2] commit: add support for --fixup <commit> -m"<extra message>"
On Fri, Dec 22 2017, Junio C. Hamano jotted:
Quoted 7 lines
Quoted 3 lines · Ævar Arnfjörð Bjarmason
I don't agree that git as a tool should be so opinionated. You can edit these --fixup messages right now with --edit, and I do. That it doesn't work with -m"" as it should is a longstanding UI wart.
I think you missed the point.
I did, yes. Sorry, I was being a bit touchy and argumentative there.
Quoted 6 lines
I was expressing my opinion, not an opinion of Git as a tool, that I think one of these two "use case" scenario was a bad way not to be encouraged.
That is totally different from allowing --fixup and -m working together. That is a good thing that helps the other "good" use case.
Documentation/git-commit.txt OPTIONS · line 146
Quoted 12 lines · Ævar Arnfjörð Bjarmason
Document that providing any of -c, -C, -F and --fixup along with -m will result in an error. Some variant of this has been errored about explicitly since
0c091296c0("git-commit: log parameter updates.", 2005-08-08), but the documentation was never updated to reflect this.Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
Documentation/git-commit.txt +3
-0@@ -144,6 +144,9 @@ OPTIONS ++ +Combining the `-m` option and any of `-c`, `-C`, `-F` or `--fixup` +will result in an error.
This sounds a bit scary, as if there is something wrong with Git. Perhaps say instead that they are "mutually exclusive":
The -m option is mutually exclusive with -c, -C, -F, and --fixup.
Or something.