Version Control – Where to Write the Version Number in Code or Repository

branchinggitversion controlversioning

Right now I'm doing this:

  1. Update the readme to include the new version number and what it does.
  2. Commit the version number in git commit message (i.e git commit -m "1.2.1: this does that").
  3. Push the repository.

Is this the proper way of doing it? I had a hunch that this is wrong, because this way I have no idea how to version the branches.
Previously I'm almost always working directly in Master, because more often than not I'm working on a repository alone. I want to change this.

Edit: specifically I'm working on web apps where I have no compiled binaries.

Best Answer

Your code doesn't have a version. It's your compiled program which has a version.

Create the version number when you do the build and have a build step which tags the git repo at the point at which it pulled the source, with that version number

Related Topic