customcommander
customcommander

Reputation: 18901

Is `git commit --amend -C HEAD` the same as `git commit --amend --no-edit`?

It seems that both commands will do exactly the same thing which is adding some staged changes to the last commit without invoking the editor.

I'm just curious to know if there are any technical differences that I am not aware of.

Thank you.

Upvotes: 5

Views: 1570

Answers (1)

torek
torek

Reputation: 488143

Functionally, yes, they are the same: -C sets the "edit/no-edit" flag to the "no" position while choosing HEAD as the commit from which to take the initial message, while --no-edit sets the flag without setting the commit, which remains defaulted to HEAD. Note that you can combine --no-edit with -c to achieve the same result as -C.

Upvotes: 5

Related Questions