How can I enforce running grunt before git push?

I am using grunt to create production ready files from my dev files and git for source control and pushing to prod server. It works nice if a person who pushes files uses it properly (run grunt then git push).

The problem is that sometimes people forgot and just push. This does not create errors in app per se, but does not add new functionality to the project (which creates a confusion). I am trying to find a way how can I enforce running grunt before git push. So when I just run git push, it tells me: Hey you forgot to run grunt!

  • Git push/pull - Restrict by subdomain
  • Git post-receive Not running
  • Azure website and Git commit id
  • push all except an special branch
  • Cloning on ubuntu takes a long time
  • Delete large number of branches from remote
  • Currently the only theoretical way I came up with is to have increments in prod build files and run git pre-commit hook to compare these numbers and discard commits that has the same numbers. Is there any problem with this idea? Is there a better idea?

  • How to do git sub modules and why to use git sub module
  • Tell git to ignore any repos in my main repo
  • How do I move origin/master to new branch?
  • Prune origin branches that do not exist on upstream anymore
  • Github API for Python : PyGithub - get a list of all commits for a particular repository
  • Remove a folder from git tracking
  • One Solution collect form web for “How can I enforce running grunt before git push?”

    We could imagine enforcing code review (using for example Gerrit): if the committer forget, the reviewer might notice it.

    However, what about using another tool to push to prod? Having a deployer tool responsible for pushing from the repo to the prod servers would surely be more flexible than Git.

    What about for example a Jenkins server which could run every hour (or on-demand) to fetch the git repo, run Grunt, and push on the prod server?

    Git Baby is a git and github fan, let's start git clone.