The lightweight tag is just a simple pointer to a commit. There are two types of Git Tags: annotated and lightweight. But again, the HEAD will be in detached mode, which can cause your commits to be lost. Still on the subject of similarity, since branches and Tags are similar, we can check out to a tag just like we can to a branch. If we use a Git Tag to mark a commit where we should start working, we might end up with our HEAD in detached mode, meaning that the commits we’ll perform from now on are not associated to any branch-and, if their sha512 id is not saved, their track could be lost. As previously mentioned, while branches move when we commit on top of them, Git Tags do not. The pointer won’t move therefore, when we start working on the next feature to release next week, we can work safely, because the Tag will always remain in the same commit.Īlthough Git Tags and Git Branches are very alike, they each have a distinct modus operandi. Using a Git Tag, we can label the commit we used to ship a new version to the production environment and call it “v whatever version we're into,” or whatever we want to call it. Each team needs to version their software somehow. If you put these two points together, we can think of Git Tag as the ideal solution for, say, the version problem. Is There Any Reason Why I Should Use a Git Tag?Īs I mentioned earlier, a Git Tag is a way of labeling a commit, and we might want to save some specific commits to know which ones they are. But if you commit on top of a Branch, it will move to the latest commit. If you commit on top of a Git Tag, the tag will not move. There are a few tricks you can perform with both of them the main similarity is that both point to a specific commit, and the difference is that Git Tag is a static pointer while Branches are not. On the other hand, Git Tags are in some ways similar to Git Branches. It’s the difference between talking about “commit a54b72f” or “commit v1.3.2.” Which one sounds better to you? So yeah, you guessed it: Git Tag lets us identify specific commits by naming them, thus making them more meaningful and user-friendly. In non-techie language, it’s basically the same as writing down the commit sha512 id and labeling it with a name we want. Git Tag is a functionality of Git that lets us snapshot our commits. But why go to that length if Git Tag can help us with that? Git Tag? What’s That? We could always save the sha512 id of the commit and write it down on a piece of paper. We may need to know exactly where we made a specific change we may need to mark the start of a new version maybe we just want to. This is the life of a software engineer.Īmong all those changes we make every day, we’ll want to save some specific points. So, today we’ll add a feature, tomorrow we’ll tweak another one, and the day after, we’ll fix a bug. What does it really mean to develop a piece of software? Essentially, it comes down to adding changes on top of changes and (almost always) using Git along the way to manage them. To introduce Git Tags, we’ll need to revisit a concept that we software engineers all know inherently but don’t tend to think about that often.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |