Is it possible to make a git commit non-amendable?

Is there a way to protect a given git commit from being amended?

All I can think to do is to write a pre-commit hook to check the SHA against a list of ‘non-amendable’ SHAs. Does anyone know of a standard/better way?

  • Change commit message for specific commit
  • Amend past commit message in Git-Tower
  • Git - do amended commits persist?
  • Unintended commit by Git
  • I amended instead of resolving conflict in interactive rebase. Can I undo?
  • Why does git call me “clever” when I reword the last commit message?
  • Thanks.

  • Difference between checkout remote branch and pull remote branch in git?
  • How to tell git to use the correct identity (name and email) for a given project?
  • Dont push a specific commit
  • My commit-msg hook - when using full editor, comments are added to commit message
  • What is the difference between linux-next and linux-net-history git repositories?
  • Automatically fetch and pull on Debian server
  • 2 Solutions collect form web for “Is it possible to make a git commit non-amendable?”

    You can consider signing your commit with a GPG key.

    In order to do so

    • Add your GPG key as a signing key

      git config --global user.signingkey YOUR-KEY
    • Commit using the -S option

      git commit -S -m "Your commit message"

    You can tag commits using a private key so that if the commit is amended no one without the key can sign the new commit.

    Git Baby is a git and github fan, let's start git clone.