Git: Automatically Commit on Publish or Restart of Web Aplication

When developing on my local, I would like to automatically commit all outstanding changes to Git every time I republishing my web project in Eclipse. This way I can get a good view of the steps that I took in my development activities. I will of course rebase before pushing to the public repository. I only want to use this for local history.

Some details:

  • Eclipse
  • Weblogic 10.3.5
  • Web Project

I am looking for a solution that will not require me to change the project itself, so any solution that requires changes to my Servlet class, or to the web.xml will not be satisfactory, although I guess I can do that as a last resort.

Additional Information

I have found that there is a Builders section under a project’s properties. This can be configure to do whatever I want, but the only options seem to be to ether run it when manually building, during or after a clean (all of which will not commit often enough), or after an automatic build (which happens every time I save a file, making it way too often too be useful).

One Solution collect form web for “Git: Automatically Commit on Publish or Restart of Web Aplication”

automatically commit all outstanding changes to Git every time I republish my project.

“Automatically” and “outstanding changes” cannot coexist in the same sentence without some details about the criteria which would define an “outstanding change”: an “automatic” process wouldn’t know when a change is supposed to be outstanding or not.

That means an “on demand” process might be easier to implement, and call when needed.

Plus the commit message might be important to refine, as it is a big part of having a “good view of the steps that I took in my development activities.”

Whatever the Eclipse project is (here a WebLogic one), that process might simply be doing a add/commit through:

  • EGit commands (manually called through the EGit GUI, in order to fill-in a meaningful commit message)
  • or a script, and which would allows (if needed) for a post-commit hook to push that commit to a remote hosting service (like GitHub for instance), since the same commit with EGit would not trigger the post-commit hook.

Since this is supposed to be fully automatic, the other approach would be to use an ant script to trigger the “redeploy” of the weblogic app.
See for instance “Weblogic hot deployment during development (like WSSD/RAD)”.

That ant script (using a wdeploy ant task) could then make sure the redeploy target depends on another ant target which would commit and push first (like in this gist).

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