DEV Community

Malik Benkirane
Malik Benkirane

Posted on

1

A good reason to allow empty git commits

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

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay