Sobes.tech
Junior — Middle

How to specify the module version when working with Git?

sobes.tech AI

Answer from AI

In Git, the version of a module is usually indicated using tags. Tags allow you to mark a specific commit as a release with a certain version.

Example of creating a version tag:

git tag -a v1.2.3 -m "Release version 1.2.3"
git push origin v1.2.3

Here:

  • v1.2.3 is the tag name, usually using semantic versioning (semver).
  • -a means an annotated tag with a message.

After that, the tag can be used for building, deploying, or simply tracking versions.

If you need to specify the version inside the module itself (for example, in a version.txt file or in pom.xml for Maven), this is done separately, but Git tags are the standard way to mark a version in the repository history.