Sometimes it’s necessary to trigger an action for CI/CD, e.g. when you use GitLab. To do this without any changes on the code base, you can create an empty commit. For this, git has a command:
git commit --allow-empty -m "Trigger Build"
This is also described in the Git documentation:
https://git-scm.com/docs/git-commit/2.31.0#Documentation/git-commit.txt—allow-empty
--allow-empty
Usually recording a commit that has the exact same tree as its sole parent commit is a mistake, and the command prevents you from making such a commit. This option bypasses the safety, and is primarily for use by foreign SCM interface scripts.
Leave a Reply