I have a git repo and I just pushed it to a server. Then I setup a post-receive hook on the server. I want to check it works. I have to commit again just to see if it works? I would really like to just force a push while I’m trying to get this set up rather than keep making commits that have no real value. Its not working, and I just don’t get it.
$ git push --force origin master
Everything up-to-date
You need to push an older commit to achieve this. For example, you could push the commit right before the current HEAD using this comment:
After this you can push the HEAD commit again:
However, instead of pushing all the time consider calling the hook manually. That’s usually easier – but don’t forget to test with an actual push when you think everything works just to be sure.