Trigger CI/CD Rebuild Without Trivial Changes

Recently, someone on my team asked how they could trigger a rebuild of a branch on our continuous delivery/integration agent.

The initial suggestion was to introduce a trivial change - such as adding/removing whitespace to the README.
This is a viable option, and one I would have also suggested.
At least, until I saw a method that does not require any changes.

I could not remember the specifics of this method though.
To make matters worse, I was having trouble locating the information again.
This post is to prevent this situation from happening again.

How

Simply put, you tell git to allow empty change-sets.

1
git commit --allow-empty -m "Trigger Rebuild"

What other useful git nuggets exist that people may not be aware of?

References

I’ve used git for years, but I just realized I can make empty commits to trigger CI pipelines:

git commit --allow-empty -m "Updated upstream code"

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.

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×