Why Git Commit Doesn't Recognize --Amend on Git Windows?

Why Git Commit Doesn't Recognize --Amend on Git Windows?

I am trying to follow the suggestion Can you GPG sign old commits?

λ git rebase --exec 'git commit --amend --no-edit -n -S' -i develop

But getting

error: unknown option `amend'

I am running git version 2.23.0.windows.1

1

1 Answer

With the use of λ in the prompt string I guess you're using cmder as the terminal with cmd as the shell. In cmd single quotes aren't the quoting symbol so the exec string isn't passed as a single parameter. You need to change to double quotes:

git rebase --exec "git commit --amend --no-edit -n -S" -i develop

Or better change to powershell or other shells (you should already have bash if you install git on Windows). They recognize ' as the quote character so you don't need to change anything, and you get more features

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.