Push an Empty Commit in Git
Yes, you can totally push an empty commit in Git if you really want to. Here's how to do that.
β Sagar Sharma

While it sounds ridiculous to push an empty commit in Git, there are several reasons why one would want to do so such as marking a checkpoint.
The best part is Git allows you to push an empty commit without any trick as all you have to do is use the --allow-empty
flag while committing:
git commit --allow-empty -m "The empty commit"
Then you can push it to the main branch:
git push origin master
Want more details? I got you π
Pushing an empty commit in Git
Most Git users are already aware of how to commit a file in Git you may get confused as if you don't stage any file and try to commit it, then it will tell you "nothing to commit":

To push an empty commit in Git, you have to use the --allow-empty
flag with the git commit command as shown here:
git commit --allow-empty -m "Your message"

Once you are done with the commit, you can push it to the master remote:
git push origin master

There you have it!
Want to learn Git from scratch? Hear me out!
If you are new to Git, then you can start by learning how to create a new branch in Git:

Furthermore, if you want to do the same but on GitHub, then, here's how to create a new repository in GitHub:

Finally, here are some tips for setting up an effective GitHub student profile:

Let me know what else should I cover from the Git side.
A software engineer who loves to tinker with hardware till it gets crashed. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.