Viewers: in countries Watching now:
The course shows how to use Git, the popular open-source version control software, to manage changes to source code and text files. Using a step-by-step approach, author Kevin Skoglund presents the commands that enable efficient code management and reveals the fundamental concepts behind version control systems and the Git architecture. Discover how to track changes to files in a repository, review previous edits, and compare versions of a file; create branches to test new ideas without altering the main project; and merge those changes into the project if they work out. The course begins by demonstrating version control in a single-user, standalone context, before exploring how remote repositories allow users to collaborate on projects effectively.
In this movie I am going to help you to get auto-completion set up for Git. Now this is a nice bonus feature, it's not something that you have to have, you can safely skip over this movie if you want to. However, I think it's something that you're going to want over time, and it makes sense for us to go ahead and set it up at the start. Now these instructions are going to be for Mac and Unix only, because Windows should already have auto-completion included, so you shouldn't have to do anything there. So if you are on Windows, you can go ahead and skip this movie, if you are on Mac and Unix, follow along with me. Now the first thing we are going to do is download it from GitHub. I am going to walk you through all these steps one at a time and actually show you how to do it.
I wanted to give you the commands here. The first is we're going to change to our user directory, then we are going to use the Curl tool which is going to go to the URL at GitHub and download the auto-completion script into our home directory. Then we will rename it. Essentially what we are doing is just changing the name to have a dot in front it so that it becomes a dot file rather than just a regular file, and then the last thing we'll do is we are going to add it to our login configuration, so it's either the .bash_ profile or that's the bashrc file. Now if you are not familiar with these two files, and you don't know the difference between them, the best thing is to add it to your bash_profile.
If you know the difference, then add it to the one that's best for you, but otherwise you just want to add it to bash_profile and have it there, and that will be the simplest. Now what are we going to put in that .bash_profile? Well, what we want to put is a bit of code, and again, I am going to actually do this with you, but I wanted you to see it nice and big, we are going to put in if the file .git-completion. bash exists then load in the file .git-completion.bash. That's what this code does. There is a little bit of shell scripting code that does that.
If the file exists, then load it. So let's see how to actually do that. So here I am in the command line. As I said, you want to just make sure that you're in your user directory, you should be by default when you first open the window. And then we are going to use curl with the -OL-- that's not a zero, that's an O--followed by and I am just going to paste in the URL here so I don't have to type the whole thing out while you watch, it's https://github.com/git/git/raw/ master/contrib/completion/git-completion.bash, very long.
Take a moment and pause it if you need to, to make sure that you copy it all down, and once you do, hit Return, and it should download the file for you. Now we can actually see that file with ls -la, and here it is right here, git-completion.bash. Now the next step is we want to turn that into a dot file. So we are just going to say move that file, and I am just going to put the tilde in front of it just to make sure we are targeting the right file, and I can hit the Tab. And if you start typing the file name, hit Tab, and it will auto complete which is exactly what we're trying to do inside Git, we are trying to add this exact kind of auto-complete feature to Git.
And then we can type it again, but this time we have to type it out, we can't auto-complete what we wanted to be, so auto-completion.bash, make sure you spelled it right, and then I am actually going to go ahead just to be sure and put the ~/ in front of it. So there it is. Now if we do ls -la again and see the listing, you will see that now it's listed up here with all the dot files, and it's been renamed with a dot in front of it. Now the next thing is we want to edit this bash_profile. Now again if you have a bashrc file, you can edit that instead, but I'm going to edit .bash_profile.
And the way that we want to do that--I am going to do it with the nano text editor--you can also do it with TextMate if you have TextMate installed,. But I am going to show you with nano because everyone should have nano installed .bash_profile. There it is. You can see that I've got a couple of things in there already for my configurations. You may have something different or nothing at all. Now what we want to put in here is that little bit of shell scripting code. Again, I am going to copy and paste it rather than type it all out, we just change the indenting here, there it goes.
So if and then in square brackets, space, -f, and then in my user directory, look for that git-completion file, close the square bracket, semicolon, then so that says if it can find the file, then load it. That's what this source does, it says read the file in and actually load everything that's in it, run it as a script. So that's what source does and the last line is fi. That's closing this if statement there, that's not a typo, it is fi, and it's what let's us know that we've finished from if down to fi is everything in the script.
I know it's kind of an odd way of doing things, but that's how the shell scripting works. And then when we are done, you will see down here it says Exit and to get this character, it's Ctrl+X, so Ctrl+X will exit, save it, and type a Y, and it will say what do you want to call this file just hit Return because it already has the old name there. And now when we close this window and reopen it, now it will have loaded in that git-completion code. Now we'll see that later, we'll work with it later, but if you follow those steps, it is installed now.
This is nice because it means we can do things like type git, and then we can start typing a word like H, and we hit Tab, it will now complete that word for us. It will do the same thing for commands and branches and a lot of the different things that we are going to be working with in Git, it will have those ready to auto complete on the command line for us and help us speed things up. Now in the next movie, we'll talk about what the command git help does for you.
Find answers to the most frequently asked questions about Git Essential Training .
Here are the FAQs that matched your search "" :
1. To add "-mmacosx-version-min=10.6" as described here:https://stackoverflow.com/questions/14268887/what-is-the-illegal-instruction-4-error-and-why-does-mmacosx-version-min-10https://stackoverflow.com/questions/10177038/illegal-instruction-4-shows-up-in-os-x-lion
2. Or to use the version of git that comes with Xcode, or to use homebrew to install git instead.http://superuser.com/questions/697144/installed-git-not-sure-how-to-get-it-working
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
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.