Change Pre-commit Ids

Viewed 23

I am checking my commits and pre-commit Ids for validation. I am using the following command to get the list

git log -10 --no-merges master | Select-String -Pattern "commit"

And I found Last commit message missed the pre-commit

enter image description here

Is there any way to correct (Add missing pre-commits)? much appreciate your help

1 Answers

If it is the last commit, you can simply:

  • run your pre-commit to check/get the ID
  • amend the last commit message (git commit --amend) with that checked ID
  • and force push (git push --force).

Make sure to notify your collaborators on the project, for them to update their origin/master whose last commit would have changed ID.

Related