At times you may want to manually initiate and trigger a build to generate an artifact or kick-start a workflow but it only works when a code commit happens.
If you do not have anything to commit to your git repo, in such cases usually a hack people do is to change a code file (such as a comment line) and add to the staging area and commit-push.
Clean way to perform an empty commit
Make use of the flag --allow-empty with the git commit command,
Example:% git commit --allow-empty -m "Empty commit"
[main 549a3bf] Empty commit
% git log --oneline
549a3bf (HEAD -> main) Empty commit
6ac92d6 4th commit
06250f0 3rd commit
2712514 2nd commit
a3e24f4 1st commit

-
Have Questions? Post them here!
More Posts related to Git,
- How to ignore files in git using .gitignore file
- How to update expired GitHub token on local git remote config
- How to undo last Git Commit on Local Repository?
- Git Commit - Author identity unknown, Please tell me who you are email
- Git: Step-by-Step - How to Push Local Brach to GitHub
- [Solution] fatal: not a git repository (or any of the parent directories): .git
- Remove git config at Local, Global or System Levels?
- Change the default git branch name from master to main
- fix fatal: --local can only be used inside a git repository error
- Git Remove Untracked Files using Command
- How to remove or unstage a file from git staged area
- Fix Git: Warning: could not find UI helper GitHub.UI on Windows
- Fix [oh-my-zsh] Cant update: not a git repository
- Get List of all local branches git command
- Github: fatal: Authentication failed Support for password was removed on August 13, 2021
- [fix] fatal: this operation must be run in a work tree in git
- How to Install Git on Windows
- Perform an Empty Commit in Git without anything in Staging Area
- Rename git branch on Local and GitHub Remove using Command
- Fix: error: could not lock config file /etc/gitconfig: Permission denied
- Get the file location of git config values
- Git: Delete Branch Locally and Remotely at Origin
- fatal: Unable to create '/c/git_repo/.git/index.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier.
- Github: How to Invite Collaborators
- How to change directory in Git bash
More Posts:
- Fix SharePoint PowerShell error - The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program - SharePoint
- How to turn off Stage Manager - macOS Ventura - MacOS
- How to Setup maven on Mac (macOS) - Mac-OS-X
- SharePoint installation error - Setup is unable to proceed due to the following error This product requires Microsoft .Net Framework 4.5 - SharePoint
- Android Error Unexpected cast to Button: layout tag was FrameLayout - Android
- Find your macOS version - MacOS
- Safari Full Screen Shortcut using Keyboard [macOS] - MacOS
- Horizontally Center Align