Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Tagging in Git is really easy. Tags are called tags. To create a tag, we'll say git tag, add the tag, v1, and then we'll add a message to indicate what it is we want, like Label version 1. Now to see the tags in your repository, it's as simple as saying git tag. To see what's in a specific tag, you can just type git show and the tag, and here we can see that the tag is shown, and it specifically shows up here at the top that I made the tag and when I did and exactly what is in there and what the various differences are between that tag and what's in my working set.
Now, if I want to go back to that tag at a later date, for example, in order to fix the bug, I can say, git checkout v1, and if I want to get back to the HEAD, I can say git checkout HEAD. Because branching is very easy in Git, you want to do a checkout to your tag and then do a branch there to allow you to make sure your changes are independent of whatever changes you were actually doing at the HEAD. So for example, if you had to come back to version 1 three months from now, you'll do a checkout v1, you'll branch at that point, make your changes there, and you may merge them back into the main branch, or you may keep that separate as your version 1 branch from now on.
One last thing. If you want your tags to be copied to a remote repository, you have to use the command git push --tags, like this, and if you want to pull them from a remote repository you use git pull --tags, with the appropriate additional arguments here that indicate which repository you're pulling from or pushing from. So tags are not by default automatically copied on a push or pull. All right, that's tags in Git. It's really, really simple. It allows you to just back up to wherever you were at that particular point and carry on.
Again, I highly recommend if you're going to use tags, when you do a git checkout at a particular tag, do a branch at that point. As you'll see in the next movie, branching is really easy so that you make sure that you carry on with your version 1 independently of the changes you might have already made up to that point, say when you're working on version 1.1 or version 2.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 99447 Viewers
56 Video lessons · 112683 Viewers
71 Video lessons · 81502 Viewers
131 Video lessons · 39125 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.