Question

I regularly run

git commit --only --amend

to reword the commit message of the latest commit I made. This will work irrespective of whether my working directory is clean or not.

Today I noticed that when doing this, the default instructions for writing commit messages shown in my core.editor include the following comment:

# Clever... amending the last one with dirty index.

Aside from having a bit of an easter egg charm to it, what is this message supposed to tell me? Is it an ironic way of saying that I should be careful when messing with previous commits (esp. if there are staged/unstaged changes present)? And why does it show up even if my working directory is clean?

Was it helpful?

Solution

I think this might be the original commit message:

git-commit --amend: two fixes.

When running "git commit --amend" only to fix the commit log
message without any content change, we mistakenly showed the
git-status output that says "nothing to commit" without
commenting it out.

If you have already run update-index but you want to amend the
top commit, "git commit --amend --only" without any paths should
have worked, because --only means "starting from the base
commit, update-index these paths only to prepare the index to
commit, and perform the commit".  However, we refused -o without
paths.

Signed-off-by: Junio C Hamano <junkio@cox.net>

I'm not very git proficient, but to me it does look like a genuine compliment for getting around the dirty index by using --only without paths

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top