FREELessons: 24Length: 3.1 hours

Next lesson playing in 5 seconds

  • Overview
  • Transcript

6.5 GUIs

If you weren't entirely comfortable on the command line, you might find yourself saying that you like the tools that git gives you, but you don't like that you have to use them in the terminal. If that's the case, there are a few GUIs, or graphical user interfaces for git, that you might want to check out. They give you all the main functionality of git, while taking away all the difficulty of using the command line. There are actually a lot of different graphical applications for git and there's no way I could teach you how to use all of them, so we're just going to look at a few of the mainstream popular ones. First off there's GitHub for Mac and then its counterpart GitHub for Windows. These are Git and GitHub clients that were released by GitHub themselves and they allow you to pretty much do all the things you would expect to do with a Git GUI. As you can see here, we can clone repositories, browse history, commit changes, branch code, and share code on GitHub. That's with the Mac one. If we look here at the Windows one it can do all the same things as well. As you can see, here are the same five bullets. So, whether you're using the Windows client or the Mac client, you can do the same things. And of course, these programs are quite different, as you can just see from the sample screenshot here. The Mac one is very, well, Mac-like. And the Windows one looks like a very high quality Metro app, actually. There are other things. Another popular one is Tower, which is a Mac application that also integrates with GitHub, along with several other development tools that you might be familiar with. And then of course there are other smaller tools that add options to your right-click contextual menu in either Mac or Windows that allow you to manipulate specific files, while you're within the Finder or within an Explorer window, and work with your git repository that way. However, in this screencast, we're just going to take a quick look at GitHub for Mac, because I think it's very representative of the way that most of these all-in-one Git GUI applications work. So we're gonna go ahead and download it here, and now that it's finished downloading, I'm just going to open up this ZIP file, and as you can see we're given a GitHub application. I'm gonna open up my Applications folder, drag the GitHub application in there and then I will launch it with Alfred. Now when you open GitHub for Mac for the first time, you're gonna be asked to give it your username and password for GitHub, as well as your name and email address that you want to be used in commits. Note there's a little message there that says that email address and name that you give it will overwrite anything that's in your local.gitconfig file in your home directory. However, once you have already signed in, this is what you are going to see. It's found this one project on my desktop, and it knows that this is the same project that I actually have on my GitHub account on the web site. If I click on GitHub over here on the left sidebar, you can see that it also points out that I have two other git repositories here that are up on my GitHub account that it could not find on my own computer. With our repository, I could choose right now just to clone this to my computer, and if I do it's gonna ask me where do I want to clone it to. I could say just clone it to my desktop, go ahead and clone, and as you can see now, it's gonna clone that down and now I have that repository right here. The handy thing about this is if you're just browsing the GitHub website and you happen to see, hey look, this is a neat git repository, I'd love to clone it down and play around with it a bit. You can just click the Clone in Mac button, and if I go ahead and click that and say, yes I give you permission to launch the application, you can see where it asked, where do you want to clone it to? I'll go ahead and clone it to the Desktop, and now here on the Desktop, you can see I have the jQuery repository. I'm gonna go ahead and delete those two extra repositories, and now let's come back here to our repositories on my own computer, and I'm gonna click this arrow to move into the repository. So right away you can see we're taken to the Changes tab, and it looks like it's saying that there's uncommitted changes, but actually there aren't. So don't get confused by that. If we scroll down here, you can see that we actually have a bunch of commits that are unsynced. This just basically means we haven't pushed these to GitHub. So if I go ahead and click Sync here, what it's actually going to do is do a git push, and push all of these commits that we've made right here up to GitHub. Now that those have synced, and you can see we have no unsynced commits, if I come over to my GitHub page, you can see that the latest commit that we made is that merge branch bugfix which is where we made, fix that terrible bug, exclamation points. So you can see that we certainly have pushed all those commits up to GitHub. All right, let's see what else we can do. If we come here to the Branches tab, we have our master branch at the top here. Notice that it says this branch has been published. This means that GitHub does have a copy of this branch, and we have to synchronize that. Same with the gh-pages branch here, it's been published. However, our bug-fix branch has not been published, and we actually don't wanna publish that. In fact, I'm gonna choose to delete this branch right here, because we did merge those changes in. Very good, so now we've made that change, however, I think one of the best things about a Git GUI like this is viewing your history. If I come up here to the History tab, you can see we here have a whole history of the different commits we've made. And if I click, let's say, on this commit right here, I'm gonna choose to go into this commit. And we can see exactly what changes were made in this commit, what files they were made to. We have the commit hash, we have the committer, the time, the message. We can even choose to rollback to this commit, which would mean undo all of the changes that have occurred after this commit and bring our repository back to this stage. And this is something that's tricky enough to do on the command line that we're not even gonna be discussing it in this git essentials course. We also have the option to view this commit on GitHub if we want, but let's actually make some changes. But notice that within all of this, there's nowhere where we can actually make the changes to the files, so let's open up our Terminal again and move back into our project, and actually make some changes. Okay, so let's just do what we've always done, move into our ReadMe file here, and I will just make another change at the bottom. Now that I've made that change, I'm gonna save and close the file, and I'm gonna come back here to the GitHub GUI. And now you can see on the right-hand side here, these are the changes that have not been staged or committed. We have a little tip here, click line numbers to select specific lines for commit. So as you can see, having a graphical application like this makes a little more of a tricky thing, such as doing a patch where we commit specific lines of the file. Something as simple as saying, I'd like to choose to commit this line, or I wanna choose to commit this line and not this line, or I'm just going to leave those unselected and make sure we're committing the whole file. Gonna close that tip there, and over here, we have uncommitted changes. We can choose to select everything, or we could just select specific files if there was more than one change file listed here. I'm going to add my commit message here. If I wanted to, I could add an extended description, but I'm not going to do that. And now I can just choose Commit, and now that commit has been made, as you can see right there. And if I come back to the Terminal, if I run git status, you can see that nothing is on the master branch, and that our master branch is ahead of origin master by one commit. And that's the one commit that we just made right here. As you can see, there's one unsynced commit. I will just choose to the sync that commit and now that that commit is sunk over here on GitHub, you can see that the change we just made has already made it to GitHub right here at the bottom. So if you don't like using the command line, you can definitely see how something like GitHub for Mac would be useful. From the File tab here we could just choose to create a new repository. We could go ahead and create it wherever we want. So you can create your project repository in here, open it up in your text editor, something like Coda or Textmate where you have the entire project directories there in a sidebar, make changes and flip back and forth between GitHub for Mac and your preferred text editor. You never even have to go to the command line, and you can do pretty much every common task that you might ever need to do in a git repository from right here within GitHub for Mac, make any code changes in your text editor, and you never even have to touch the command line. So that is a very quick look at git GUIs. The point of this video wasn't to teach you how to use a graphical application for Git, so much as it was to show you what your options are and what a graphical application for Git would actually do and how you would use it and interact with your code changes. And then actually use an application to make the commits. So if this is the way that you would prefer to use Git, this video has given you a few ideas of what to look for in such an application.

Back to the top