Git - push empty commit to remote to force project rebuild on remote

8 points
Created by:

In this short article we want to show how to push empty commit to remote with Git. That kind of operation is useful when we want to force project rebuilding on remote and we dont want to send any changes (useful for Jenkins, GitLab, etc. after pipeline failed because of non current project issue).

Quick solution:

git commit --allow-empty -m "Triggering build"
git push

When we dont want to run local tests, rebuilding etc. we can use:

git commit --no-verify --allow-empty -m "Triggering build"
git push --no-verify


Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.