Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this movie, we're going to learn how to rename branches. We saw how to create branches already, and we created a few. Git branch will show us the list, you can see I've got master currently checked out, and I have also got the new_feature branch and the shorten_title branch. Now shorten_title is pretty descriptive, you can kind of guess what that's about, especially, if there's 10 different branches, you can kind of pick out which one it is. But new_feature that's really vague and not at all descriptive. So it's much a better idea to give these a very descriptive name letting us know what they do.
So what does the new_feature branch do? Well, I made it off of master. So let's take a look, let's see what it does. Let's do git diff master..new_feature. So that shows us what it does. What it does is it adds that chunk of text right after Welcome to Explore California. We were just sort of adding text at that time but in the real world, we have to ask ourselves, well, why were we hitting this text? What were we trying to do by adding it. Were we trying to be more descriptive? Were we trying to improve our search engine results? Let's says that it's the second one.
Let's say that we're trying to improve our search engine results. That's a process called search engine optimization, or SEO for short. So what I am going to name this new branch that's more descriptive is going it be SEO title. I am going to give it SEO title to let me know that that's what I was up to. So the way that we're going to rename the branch is we will say, get branch -m for move, or we can also use the full word with two dashes, --move like that. Usually, you just use the one. So get branch move, and I'm going to move the new_feature branch to a new SEO title.
Now it's not actually moving it, it's renaming it. As we saw earlier when we were working with files in Git, they are really the same thing. Git considers a re-name to be a move, the same way that UNIX does. So if we say git new_feature seo title, and we do git branch, we see our list, now we see our seo_title branch. So that's it. That's all there is to renaming branches. Just be sure that you do give your branches good names. Names that help you to distinguish what they're all about. Now if are working in a large organization, and you're doing, let's say, trouble tickets where you are fixing bugs and things like that, there might be some kind of a support ticket attached to it.
In that case, maybe you want to name your branch with the ticket name, maybe it's ticket 375 something like that, but you want some way that you can look through at a glance and pick out the branch that you're looking for.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101672 Viewers
61 Video lessons · 88422 Viewers
71 Video lessons · 72266 Viewers
56 Video lessons · 103990 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.
Your file was successfully uploaded.