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

Re: Editing a typo in the message given to "git commit"

From
EWEric Wong <e@80x24.org>
Date
Aug 21, 2016, 21:29 UTC
Message-ID
<20160821212927.GA8516@dcvr>
In-Reply-To
<CAFZEwPP=d6fN4MC09JGm4neY5MuXv1JBzx87HC+8=XjEp=DS_w@mail.gmail.com>
Pranit Bauva <pranit.bauva@gmail.com> wrote:
Show 20 quoted lines
> On Sun, Aug 21, 2016 at 8:49 PM,  <norm@dad.org> wrote:
> > I am learning how to use git. I would like to know:
> >
> > How can I correct a typo in the message I gave to an old "git commit"? I see
> > that the typo occurs in exactly two files in .git:
> >
> > .git/logs/refs/heads/master
> > .git/logs/HEAD
> >
> > /usr/bin/file says that they are both ASCII English text. So I could just
> > hand edit them. But that seems somehow sacrilegious and might break git.
> 
> Messages to commits aren't just stored in these two files.
> Hand editing them will definitely break git and its highly advisable
> not to do that. In fact, for beginners its highly recommended to never
> visit the ".git" folder. What you need in this case is `git-rebase
> -i`. Using that you can go to the commit where you want to edit the
> message and mark it as "reword". Also if you want to make some
> modifications in the code, then you can mark it as "edit". Try `man
> git-rebase` for more info on the command.

Agreed. I use "git commit --amend" if it's the latest commit; saves typing. Definitely don't edit anything in .git/logs/ by hand.

Show 6 quoted lines
> Also on a side note: This is a developer's mailing list. Please try to
> use the user's mailing list[1] for doubts. But if you have a doubt as
> to why this commands functions in a particular way (in which you think
> it should not) or you find a possible bug then feel free to discuss it
> on this mailing list. Also to save other people's time, first search
> for the doubt in the archives or google about it.

I disagree with this being a developer's-only list and pointing users to a separate list. Every git user is a potential developer (especially for a tool aimed for managing source). Often user questions turn into bug reports aimed at developers.

Nothing in our manpages even mentions this git-users list.
> [1]: https://groups.google.com/forum/#!forum/git-users

Keep in mind I have a strong anti-centralization bias and Google is a big basket, here. I'll let their history of discontinuing services like Google Reader, Google Code, etc. speak for itself :)

Previous: Pranit BauvaNext: Jakub Narębski
Message 3 of 4 in “Editing a typo in the message given to "git commit"”
  1. norm@dad.orgAug 21, 2016
  2. Pranit BauvaAug 21, 2016
  3. Eric WongAug 21, 2016
  4. Jakub NarębskiAug 22, 2016

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.