Blog Datasheets Home About me Clients My work Services Contact

G2Labs Grzegorz Grzęda

Git versioning projects

April 24, 2023

Premise

While developing a project usually I don’t need to version it. The git history does all what I need. But when my project should be used somewhere else, I can’t rely on commit-to-commit history. I need some versioning, so I can look at the numbers and deduce what consequences each version introduces.

Solution

Here I came up (heavily influenced by semantic versioning) with this simple formula:

1
vMAJOR.MINOR.PATCH

examples:

1
2
3
v1.2.3
v10.2.3
v2.10.1232

Explanations

I increment each number:

I add the v prefix for git tagging purposes, not to start a tag name from a number.

Application

I apply this versioning in project’s:

Now, if I use my project e.g. as a git submodule, I checkout to it’s tagged version.

If I utilise some script to download a flat repo I also checkout to that git version tag.


➡️ Strategies for improving code readability and maintainability


⬅️ VT100 shell coloring for python logging


Go back to Posts.