git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: bug: `git commit --verbose` not removing text below scissor-line

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 10, 2025, 15:45 UTC
Message-ID
<xmqqecuo82xq.fsf@gitster.g>
In-Reply-To
<CACpw4KCYrgjCPO6z-czSa=rW+5z5m4Xpy_RSgxEkUGdeMEvULA@mail.gmail.com>
Oren Levi <orenl@exon-media.com> writes:
> What did you do before the bug happened? (Steps to reproduce your issue)
> 1. Run `git ci -a`
> 2. Edit COMMIT_EDITMSG (using vscode)
> 3. Save&Close

As you have commit.verbose set, and your "ci" is merely a short-hand for "commit", this is "git commit -a -v". It should give us a patch text after a scissors line, that looks like

    #
    # ------------------------ >8 ------------------------
    # Do not modify or remove the line above.
    # Everything below it will be ignored.
    diff --git c/builtin/fetch.c i/builtin/fetch.c
    index d48262bdc7..3267617a54 100644
    --- c/builtin/fetch.c
    +++ i/builtin/fetch.c
    @@ -640,9 +640,6 @@ static struct ref *get_ref_map(struct remote *remote,
            return ref_map;
     }
Here is what I did as a quick sanity check
    $ git checkout --detach HEAD
    $ git reset --soft HEAD~23
    $ git commit -a -v
and
 (1) I do see the "# ---- >8 ----" followed by "# Do not modify or
     remove the line above."
 (2) after making edit near the top of the file, without touching
     anything around the "---- >8 ----" line, saving the file made a
     commit.
 (3) "git show" does show the patch after the log message, but "git
     show -s" or "git cat-file commit HEAD" do not, i.e. "Everything
     below is ignored." the message says was true.
so, in short, does not reproduce for me with the info provided.

Since I do not use vscode, my reproduction attempt used an editor different from it. It is possible that your editor may be mangling the line that it is not supposed to touch, but that is not something I can tell.

Show 5 quoted lines
> Anything else you want to add:
> related config:
> core.editor = code --wait
> commit.verbose = true
> alias.ci = commit
Previous: Oren LeviNext: Eric Sunshine
Message 2 of 3 in “bug: `git commit --verbose` not removing text below scissor-line”
  1. Oren LeviJul 10, 2025
  2. Junio C HamanoJul 10, 2025
  3. Eric SunshineJul 10, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.