Create an empty commit

Print Friendly, PDF & Email

We use VCS as the back-end technology to track changes made on each submission or dataset into our system. The users or submitters can update their submissions and all changes will be recorded under our system backed by GIT. When updating a submission, a new revision will be created to capture the updates and a commit will also be created. However, some updates don’t change the files coming alongside the submission but edited some metadata on that submission/dataset. In this case, an empty commit is created to match the newly created version.

  • Use git commit --allow-empty -m <message> to create an empty commit with the provided <message>.
git commit --allow-empty -m <message>
git commit --allow-empty -m "Empty commit"
# Creates an empty commit with the message "Empty commit" 

This command will create a new commit without adding any files but allowing us to give a comment on it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.