summaryrefslogtreecommitdiff
path: root/Documentation/git-commit.adoc
AgeCommit message (Collapse)AuthorFilesLines
2026-05-26commit: allow -c/-C for all kinds of --fixupErik Cervin-Edin1-4/+5
The previous commit allowed -m and -F for all --fixup variations. The -c/-C flags were blocked by the same higher-layer incompatibility check that previously caught -F, namely die_for_incompatible_opt4() grouping them with --fixup. Drop --fixup from that check and route the resolved commit through prepare_amend_commit() in the fixup path, mirroring the no-message-source behaviour of --fixup=amend. With this in place, -m/-F/-c/-C all behave consistently across the plain, amend, and reword --fixup forms. Signed-off-by: Erik Cervin-Edin <erik@cervined.in> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-26commit: allow -m/-F for all kinds of --fixupErik Cervin-Edin1-9/+10
The ability to provide a commit message for git commit --fixup and its variations is limited: * Plain --fixup only allows using the -m flag * The amend/reword --fixup variants only allow supplying the message using an editor For amend/reword, the -m and -F flags are rejected: -m is caught by a die() in prepare_to_commit(), and -F is caught by die_for_incompatible_opt4() which groups -F with --fixup as mutually exclusive. This makes these modes poorly suited for non-interactive workflows -- notably when using AI coding agents. When support to use the -m option was introduced in [1] it was noted that there could be support for other options but at the time the use case was deemed too niche. Later, when the amend suboption was introduced in [2] -m support for amend fixups was discussed but not pursued, and -F was already caught by the higher-layer incompatibility check grouping it with --fixup. The rejections of these options hark back to when --fixup was introduced in [3] and as noted in [1] -- there's nothing inherently preventing support for them. The current patchwork of which flags work with which --fixup variants has no strong logic to it, and allowing all of them simplifies both the code and the interface. Allow -m and -F to supply the message body for all --fixup variations, mirroring the flow of a regular commit. -c and -C, which are blocked by the same incompatibility check, are handled in the next commit. 1. 30884c9afc (commit: add support for --fixup <commit> -m"<extra message>", 2017-12-22) 2. 494d314a05 (commit: add amend suboption to --fixup to create amend! commit, 2021-03-15) 3. d71b8ba7c9 (commit: --fixup option for use with rebase --autosquash, 2010-11-02) Helped-by: Junio C Hamano <gitster@pobox.com> Suggested-by: Phillip Wood <phillip.wood123@gmail.com> Signed-off-by: Erik Cervin-Edin <erik@cervined.in> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-11-14doc: commit: link to git-status(1) on all format optionsKristoffer Haugsbakk1-4/+6
`--branch` and `--long` refer to git-status(1) options but they don’t tell us what `short-format` and `long-format` are, respectively. And `--null` mentions “status” but does not link to the command. Refer to git-config(1) on `--branch` like `--short` does. `long-format` is the git-status(1) output. So we can just say that directly. Replace “status” with a `linkgit` on `--null`. Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-11doc: check for absence of the form --[no-]parameterJean-Noël Avila1-1/+2
For better searchability, this commit adds a check to ensure that parameters expressed in the form of `--[no-]parameter` are not used in the documentation. In the place of such parameters, the documentation should list two separate parameters: `--parameter` and `--no-parameter`. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-11doc: check well-formedness of delimited sectionsJean-Noël Avila1-0/+1
Having an empty line before each delimited sections is not required by asciidoc, but it is a safety measure that prevents generating malformed asciidoc when generating translated documentation. When a delimited section appears just after a paragraph, the asciidoc processor checks that the length of the delimited section header is different from the length of the paragraph. If it is not, the asciidoc processor will generate a title. In the original English documentation, this is not a problem because the authors always check the output of the asciidoc processor and fix the length of the delimited section header if it turns out to be the same as the paragraph length. However, this is not the case for translations, where the authors have no way to check the length of the delimited section header or the output of the asciidoc processor. This can lead to a section title that is not intended. Indeed, this test also checks that titles are correctly formed, that is, the length of the underline is equal to the length of the title (otherwise it would not be a title but a section header). Finally, this test checks that the delimited section are terminated within the same file. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-29add-patch: add diff.context command line overridesLeon Michalak1-0/+2
This patch compliments the previous commit, where builtins that use add-patch infrastructure now respect diff.context and diff.interHunkContext file configurations. In particular, this patch helps users who don't want to set persistent context configurations or just want a way to override them on a one-time basis, by allowing the relevant builtins to accept corresponding command line options that override the file configurations. This mimics commands such as diff and log, which allow for both context file configuration and command line overrides. Signed-off-by: Leon Michalak <leonmichalak6@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-02-25Merge branch 'mh/doc-commit-title-not-subject'Junio C Hamano1-4/+4
The documentation of "git commit" and "git rebase" now refer to commit titles as such, not "subject". * mh/doc-commit-title-not-subject: doc: use 'title' consistently
2025-02-14Merge branch 'bc/doc-adoc-not-txt'Junio C Hamano1-0/+589
All the documentation .txt files have been renamed to .adoc to help content aware editors. * bc/doc-adoc-not-txt: Remove obsolete ".txt" extensions for AsciiDoc files doc: use .adoc extension for AsciiDoc files gitattributes: mark AsciiDoc files as LF-only editorconfig: add .adoc extension doc: update gitignore for .adoc extension
2025-01-21doc: use .adoc extension for AsciiDoc filesbrian m. carlson1-0/+592
We presently use the ".txt" extension for our AsciiDoc files. While not wrong, most editors do not associate this extension with AsciiDoc, meaning that contributors don't get automatic editor functionality that could be useful, such as syntax highlighting and prose linting. It is much more common to use the ".adoc" extension for AsciiDoc files, since this helps editors automatically detect files and also allows various forges to provide rich (HTML-like) rendering. Let's do that here, renaming all of the files and updating the includes where relevant. Adjust the various build scripts and makefiles to use the new extension as well. Note that this should not result in any user-visible changes to the documentation. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>