Check out a free preview of the full Everything You'll Need to Know About Git course

The "Tags & Other Tools" Lesson is part of the full, Everything You'll Need to Know About Git course featured in this preview video. Here's what you'd learn in this lesson:

ThePrimeagen explains how to use tags in Git and demonstrates how to create, delete, list, and checkout tags. He also mentions that tags show up in the log and can be pulled and pushed just like branches. The tool "fugitive" and some of its features, such as staging and committing changes, pushing to a remote, stashing, and interactive rebasing are also introduced in this lesson.

Preview
Close

Transcript from the "Tags & Other Tools" Lesson

[00:00:00]
>> Or onto named locations in GIT History. This is effectively me saying tags, right? I call it a named location because it's not a branch, because a tag is an immutable point in history. Unlike a branch, branches you update, you make commits to, they move all around. A tag is an immutable point in your Git history.

[00:00:19]
And so the best way to think about it is that it has all the setup of a branch just without changeability. How to use tags? Very easy if you've never used tags. Simply do git tag, the name of the tag you want to create, git take delete if you wanna delete it, git take the list amount, git checkout a tag name and you'll check out a tag as if it were a branch except for you're just checking out a Shaw and so you'll be in a detached head state.

[00:00:46]
So kind of fun stuff. I go through the various operations here. We'll do this one right here. I think this one's really interesting texts also show up in the log so long as us decorate with decorates like your default option if you create it Tag git tag foobar, and I go git log.

[00:01:04]
You'll see right here, it also shows up so you know which one you're looking at. So if you're trying to look for a specific version, this is fantastic. You can pull tags with git pull dash dash tags. So it's just like working with branches effectively, you can push tags with git push dash Stash tags will push tags up to to an endpoint.

[00:01:23]
There you go. That's pretty much everything about tags. I'm gonna largely kind of skip this version because I don't think I've said everything about it there's not you know, we kind of know at this point how to use branches. I've been using them all day. You understand tags inherently right any questions on tags that is now they're put Pretty straightforward, right?

[00:01:42]
>> Yeah, merge them back and forth.
>> You just can't change them.
>> Yeah, That's it.
>> That's it. All right. My favorite tool to use is fugitive. So that's gonna give you a little quick look. I don't I mean, I use the command line like maybe half the time the other half the time I use fugitive.

[00:01:59]
It's pretty dang awesome so far. If I go in here, add a new line. This is my unstaged changes, right? I can stage them, I can put them into that I can onstage them, I can remove them. It's very, very nice to be able to have those kinda fast usages of Git.

[00:02:11]
I think it just makes life a little bit nicer, especially as you get good at it. Let's see, right here and let's do one more thing. Just to make it nice, you can. It allows you to do commit messages right in your editor, which is also fantastic. I like that and it also allows if there was an upstream to push to here, let's go down to.

[00:02:31]
Let's go to what's called remote Git. I can also go in here, and I can also push if I want to. So if I press Enter now It's gonna go push this up to remote it's not going to work because we may change to Hello good and there's problems we have to rethink, but I can do that if I want to.

[00:02:47]
I can also jump in here. Go into here and I can see it. It's now stashed CCA and it's unstaffed, it's kind of nice to be able to do that it's easy to rebase if I If I really wanted to hit it with the old R, I know do something on I have some on stage.

[00:03:04]
Right? I can go in here and let's not do that one. There we go and I can go give it the old Ri and go s. There we go. I've now just did an interactive rebase just change it to one commit. So having a good tool to be able to work with Git is worth a whole bunch So whatever tool you use, I hope well, first off, Vim's fantastic if you don't use Vim.

[00:03:24]
But if you don't use it and you use that other editor, just learn the tool. I think it's Git Lens, right? And if you get really good at it, it can just save a whole bunch of time. And the thing that really makes this stuff really good isn't, it's the reason why I didn't go over diffs.

[00:03:39]
It's really pretty much in this course. I don't think diffs are good to look at on the command line. I don't think they're enjoyable. I don't think there's any, I don't think anyone here is gonna wanna resolve a conflict by hand. We all want the ability to, look at the change like this, right?

[00:03:51]
Where you have one side and the other side, and you get to choose which side you want to use. And so, I largely don't think that that kind of stuff is useful. That's why we didn't. We didn't go over it. And so please, if you're not using a tool and you're resolving conflicts by hand, learn the tool.

[00:04:05]
It'll make your life like ten times better because they can be a real big pain in ass the if you try to do everything by hand.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now