A good reason to allow empty git commits

Malik Benkirane - Jun 7 '23 - - Dev Community

TLDR; workflow with --allow-empty

Think of 1 commit for an original pull request

#1 engage your changes before you actually want to commit
git commit --allow-empty

#2.1 engage changes with care
git commit --allow-empty -av --amend

#2.2 engage changes with determination
git add ${filenames}
git commit --allow-empty --amend

#3 you can always (squash, edit, rebase and more)
git rebase -i ${FETCH_HEAD_or_other_commit}

#4 push your changes
git push ${origin} ${branch}
Enter fullscreen mode Exit fullscreen mode

See also

https://duckduckgo.com/?q=git+commit+no+change
https://stackoverflow.com/questions/12470029/how-to-commit-no-change-and-new-message#12470056

. . . . . . . . . . . . . . . . . . . . . .