git commit and push even although no changes have been made, it's necessary to trigger web hook

Viewed 1878

I need to trigger commit and push although no changes have been made and the commit and push are not needed, but I do need it as each commit and push triggers a webhook.

So when I do:

git commit -am "release 1"

I'm getting:

On branch feature/X-111_Support
Your branch is up to date with 'origin/feature/X-111_Support'.

nothing to commit, working tree clean

As it was my previous commit. Also the files have not changed at all. How can I just commit and push it? This is done via script so no interactive mode allowed.

2 Answers

git commit --allow-empty -am 'empty commit'

If you don't care the latest hash changing, you can do git commit --amend --no-edit && git push --force.

This will only change the Commit and CommitDate information of your latest commit, which will make the hash change so you will need to force push.

Related