How do I fix a typo in a git commit comment?

Eric S. Raymond esr at
Sun Mar 25 07:46:30 UTC 2018

Hal Murray via devel <devel at>:
> The 674 should be 474.
> commit c8c888f8f2ef295c0ea5f854127069b3812e4c09
> Author: Hal Murray <murray at>
> Date:   Fri Mar 23 01:11:17 2018 -0700
>     Add logging of year(s) on large clock steps.  Issue #674

If it weren't in the public repo this would be easy - I'm enclosing a script
that does this.

Since it is, I'd have to edit it here, then unprotect the public master branch,
then force-push, then reprotect it. This will take the public repo temporarily
out of service and confuse/inconvenience people who have cloned or pulled
since your commit.

Is this important enough to do that?
		<a href="">Eric S. Raymond</a>

My work is funded by the Internet Civil Engineering Institute:
Please visit their site and donate: the civilization you save might be your own.

-------------- next part --------------
# Give this a commit-ID specification.  It will edit the associated comment.
# Usual caveats apply; the edited one and all commits after will change IDs,
# and pushing them to a repo with the old commits will wreak havoc.
# Note also that this cavalierly overwrites refs/original.
# This script by Eric S. Raymond, March 2010, all rites perverted. It's based 
# on an idea by thiago from #git, but debugged and with a safety check.
# It contains porcelain and porcelain byproducts.

topdir=`git rev-parse --show-cdup`
test -n "$topdir" && cd "$topdir"

my_commit=`git rev-parse $1` || exit $?

# Run a safety check before edits that could hose remotes.
if test -n "`git branch -r --contains $mycommit`"
    echo -n "Commit has been pushed.  Really edit? "
    read yn
    if test "$yn" != 'y'
	exit 0

test -d .git && myfile=.git/COMMIT_EDITMSG

# This effort to invoke the user's normal editor fails.
# the problem is that anything the editor writes to stdout on the
# controlling terminal becomes part of the commit message.  So
# the editor needs to actually run inside another window.
#test -z "$GIT_EDITOR" && GIT_EDITOR=vi

# xterm -e vi should also work.

export my_file my_commit my_editor

exec git filter-branch -f --tag-name-filter cat --msg-filter '
if test "$GIT_COMMIT" = "$my_commit"; then
    cat > $my_file;
    $my_editor $my_file >/dev/null;
    cat $my_file
fi' "$1~.."

# End

More information about the devel mailing list