One solution I saw was to add a dummy modification to our codebase (for example adding a space in a comment), commit it, and push it to our main branch. This would trigger our CI/CD pipeline and would result to a new deployment. This solves my problem, but the code modification is artificial.
Then, I discovered the
--allow-empty option of
git commit thanks to this tweet:
TIL that you can do `git commit --allow-empty` to make a new commit with no actual changes to your files.— Megan Sullivan (@meganesulli) March 1, 2021
No more random whitespace changes to trigger new builds! 🥳
Eventually, I ran the following command, pushed to our main branch and our staging environment was re-deployed.
git commit --allow-empty -m 'Redeploy staging environment'