Created
February 26, 2021 14:29
-
-
Save jeremyBanks/aad0136fd3bf13b117c2ee23641b97be to your computer and use it in GitHub Desktop.
replace empty commit messages with placeholder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git filter-branch --msg-filter '\ | |
export OLD_MESSAGE="$(cat)" ;\ | |
export GIT_HEIGHT="$(git rev-list --count "${GIT_COMMIT:-HEAD}")" ;\ | |
export GIT_TREE_HASH="$(git rev-parse --short=8 ${GIT_COMMIT:-HEAD}^{tree})" ;\ | |
export GIT_MESSAGE="$(printf %08d "${GIT_HEIGHT}")-${GIT_TREE_HASH}" ;\ | |
echo "${OLD_MESSAGE:-${GIT_MESSAGE}}" ;\ | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment