How to use them to compare different versions of your code
You can compare different versions of your code by making use of the “compare this A tag” command. If you have a tag that allows you to ignore each specific file that might be out of date, then you can just create an A tag with this command: “compare this tag”, which will compare the latest version of all files in the repo (except those tagged with disregard). Here is an example of what my last commit looks like: * master * compare this A tag * compare this A tag .meta .blog /README.md * compare this A tag .router /models api.go auth/passport/passport-server.go controllers/api-controllers.go models/api-model.go routes/api-routes.go router.go ** compare this A tag * compare this A tag .meta .blog /README.md * compare this A tag .router /models api.go auth/passport/passport-server.go controllers/api-controllers.go models/api-model.go routes/api-routes.go router.go
and so on…
Then, once that is done, run the following command to compare specific files: “compare this tag -f folder1/ -f folder2/”. This will compare only those folders.
The benefits of using compare tags for code management
When working with multiple people on a project, it can be hard to collaborate effectively. You can use multiple ways of code management because compare tags are just files that are created in your repository. Since these compare tags are files, they can all be added to a version control system (like Git or Mercurial). This makes it simple for someone to add a history of all of your tags.
Examples of how to use compare tags in practice
A common practice is to create a tag for every version of a feature that is implemented in your code. So you have a super-important feature and after it’s done you can use a tag like: “feature-v5”. Then all future commits to this code will be compared against this same code. When someone bugs you about one of the changes, you can tell them all the commits that were made and at which versions they are at. This makes it easy for someone to squash those commits together.
When you are doing feature toggling like [this], it is a good idea to create a tag for every possible state of your feature. That way when you do comparisons, you can use the “All” compare option and it will show all the versions that are not the same, even if they do not involve the actual code that you need to toggle.
Sometimes, people will just create git tags out of date instead. This is terrible practice but is unfortunately a common occurrence since Git became popular. If you are creating a tagged feature and want to compare it against your current implementation, you can use the comparison option with an attribute like: “com.company.feature.$n.compare”
For the other types of tags that people use, you can use the command-line git tag script:
git tag -l > TAG_LIST