Normally, Git doesn’t let you just commit nothing. But if you use the --allow-empty flag, it will.
Sometimes you need to force the rebuild of your repo (for example a GitHub Pages / Jekyll site that isn’t picking up changes), and this is a clean way to do it without making up fake file changes.
Simply run:
class="highlight">
1
git commit --allow-empty -m "Forcing website rebuild"
It creates a real commit for you, but without any changes in it. Think of it like a little nudge for your build to actually go through.
Want the full write-up? I covered empty commits for GitHub Pages rebuilds here: Using empty commits to rebuild GitHub Pages websites
Follow along for more git tips like this!
Related Articles