A Quick Guide to GitHub Desktop

logo image With this tutorial, you'll learn how to download & use GitHub Desktop for all your coding needs! Once you get the hang of it, this app makes collaborating over GitHub super easy! After reading this guide, try the simple HTML/CSS tutorial at the end to test your new skills.

Table of Contents

  1. Downloading the App
  2. Signing In
  3. Connecting to a Repository
  4. Navigating Between Branches
  5. Committing Changes
  6. Pushing Commits to the Origin
  7. Making a Pull Request
  8. A Challenge!

Downloading the App

First things first, let's download the app. Go to https://desktop.github.com/ and download the Mac or Windows version to your computer!

Signing In

Next, you'll want to link the download GitHub Desktop app with your GitHub.com account. In the Mac OS X version, you can sign in at GitHub Desktop/Preferences/Accounts. In the Microsoft Windows version, go to Files/Options/Accounts to do the same!

Connecting to a Repository

At this stage, there are a few situations you could be in. Select the one that best applies to you to keep moving through the tutorial!

  1. Adding a Local Repository (I have a folder I'm working in on my computer that I want to connect to GitHub)
  2. Creating a New Repository (I'm starting a new project from scratch!)
  3. Cloning a Repository (I already have a project set up on GitHub that I want to work on locally)

Adding a Local Repository

If you have a project that already exists on your computer, select Add Local Repository... in File. Then, in the pop-up that appears, choose the folder you're working on, and click Add Repository. Remember, while you're adding this repository from your computer, it has to correspond with an existing GitHub repository. If the repository name doesn't match one that exists on GitHub, the App will let you know and tell you to Create a New Repository instead!

Creating a New Repository

If you don't already have a repository on GitHub to work with (whether or not you have code written on your computer yet) create one by clicking New Repository... in File and filling out the form that pops up. Click Create Repository to finalize these changes!

Cloning a Repository

If you already have a repository up and running on GitHub, but want to clone it onto your computer so you can make changes, click Clone Repository... in File. From the list that will pop up, select a repository, and then choose the local path (AKA, the folder on your computer) in which you'll be working. Then, press Clone!

Now that you're working on a repository, let's talk about how to work with branches on GitHub Desktop. If you make changes that you're not sure are perfect, you probably want to save them to a unique branch, rather than alter the master branch. At the end, once you're confident with your changes & have conferred with your collaborators, you can merge that unique branch with the master branch. This will prevent any mistakes in individual commits from permanently impacting the whole project!

Work in an Existing Branch

If you already have a branch created that you want to work in, simply toggle the Current Branch box and select the branch you want from the resulting list!

Create a New Branch

If you want to create a new branch to work in, toggle the Current Branch box and click New Branch. Then, name your branch and choose whether you want it based on the master or the current branch you're on!

Committing Changes

Compared to how tricky it can be to commit changes to GitHub using the command line, it is super easy to do so on the GitHub Desktop app. As opposed to having to type out a commit command, all you have to do is name your commit and click a button!

Making a Commit

After a coding session, assuming you've connected your repository and any branches you're working on to GitHub Desktop as explained in the above steps, you'll likely have a lot of changes to save to Git. All of those changes (line by line!) will pop up in the white box underneath Current Repository/Changes. Once you're done with coding for the day, all you have to do is name your commit in the Summary box, write a Description (if you want), and click Commit to [your branch] at the bottom of the box!

Pushing Commits to the Origin

Once you've committed your changes, you'll need to push that commit to the origin so those changes will be published on GitHub, and accessible by all of your collaborators on all their different devices!

Pushing a Commit

Just as making a commit is much easier in GitHub Desktop than on the command line, pushing that commit is also much easier! All you have to do, when you have a commit waiting to be pushed to GitHub, is click the button Push origin that will show up on the app's layout after you save a commit. Voila: your change is now published to the repository. It's that easy!

Making a Pull Request

If you're ready for the changes you've made on your individual branch to be merged with the master branch, you first need to make a pull request, so all your fellow collaborators can check the change.

Create a Pull Request

Again, creating a pull request in GitHub desktop is truly as easy as clicking a button. Once you've pushed your commits to the origin, a blue box will pop up in your desktop app titled: Create a Pull Request from your current branch. All you have to do to initiate your pull request, and prepare to merge with another branch, is click Create Pull Request, and edit the request accordingly in the web form that pops up!

A Challenge

See if you can put these new skills to the test by using GitHub Desktop to clone this file to your computer, add a cute GIF of a puppy after "My GIF:" and commit that change to a new branch of this repository with the name "[yourname]-github-desktop".

My GIF: