1

I'm working on a project that has a version checker to see if it's up to date. The way I do it is by including the version in the source code of the main class and in my Github repository, I have a file that just includes the latest version.

Whenever I push to the repository, I have to increment both the version file and field in the source. Unfortunately, I'm incredibly forgetful and always forget to increment at least one of them.

A little information, I'm working in Eclipse on a Java applet. I'm not entirely sure what you'd call it but the version file is adjacent to the src/ directory (I guess the project root). I should also note that I'm a total noob with git and have absolutely no idea what I'm doing so examples would be appreciated.

Is there anyway I can easily manage the version that will guarantee that both change?

Spedwards
  • 4,167
  • 16
  • 49
  • 106

1 Answers1

1

With Git you could write a commit hook which increases that number. I would set a beginning and an end marker and have the number between them. A pre-commit-hook would increment and replace that number.

More info at the git book.

nwinkler
  • 52,665
  • 21
  • 154
  • 168