This guide will walk you through the process of using GitHub Desktop to work on a Git repository. GitHub Desktop extends and simplifies your GitHub.com workflow, using a visual interface instead of text commands on the command line. By the end of this guide, you’ll have used GitHub Desktop to create a repository, make changes to the repository, and publish the changes to GitHub.com.
Although most developers use the command line when working with version control systems, there are many GUI clients available that can potentially simplify the process. GUI clients might be especially helpful when you’re trying to see what has changed in a file since the GUI can quickly highlight and indicate the changes taking place.
Here are the quick steps to download and install the Github desktop.
- Visit the GitHub Desktop download page.
- Choose Download for Windows.
- Note: If you are a network administrator, you can use the GitHub Desktop Windows installer package to deploy GitHub Desktop.
- In your computer's Downloads folder, double-click GitHub Desktop.
- In the pop-up window, click Install.
- After the program has been installed, click Run.
- Launch GitHub Desktop and follow the initial welcome flow to sign into your GitHub account. You'll see a "Configure Git" step, where you can set your name and email address. To ensure your commits are correctly attributed to your GitHub account, use the email address associated with your GitHub account.
With GitHub Desktop open, you can drag and drop repositories from within the file manager to automatically add them to your Git repository, or you can clone a repository from your GitHub account to your local drive (repositories clone to C:\Users\NAME\Documents\GitHub–where NAME is your Windows username).
With a repository cloned to your local drive, you can start working on it locally and then compare, merge, rebase, creating a new repository, deleting repository and many more.
Once your work is complete, you can push it back to GitHub by clicking Repository - Push. If you work with a team, you can create new pull requests by clicking Repository - Pull.
After installing the Github desktop, then perform reading these actions to master the Github desktop.
Below the menu is a bar that shows the current state of your repository in GitHub Desktop:
- Current repository shows the name of the repository you're working on. You can click on the Current repository to switch to a different repository in GitHub Desktop.
- Current branch shows the name of the branch you're working on. You can click on the Current branch to view all the branches in your repository, switch to a different branch, or create a new branch. Once you create pull requests in your repository, you can also view these by clicking on the Current branch.
- Publish repository appears because you haven't published your repository to GitHub yet, which you'll do later in the next step.
In the left sidebar, you’ll find the Changes and History views.
- The Changes view shows changes you've made to files in your current branch but haven't committed to your local repository. At the bottom, you'll also notice a box with "Summary" and "Description" text boxes and a Commit to master button. This is where you'll commit new changes. The Commit button lets you know which branch you're committing your changes to.
- The History view shows the previous commits on the current branch of your repository. You should see an "Initial commit" that was created by GitHub Desktop when you created your repository. To the right of the commit, depending on the options you selected while creating your repository, you may see .gitattributes, .gitignore, LICENSE, or README files. You can click each file to see a diff for that file, which is the changes made to the file in that commit. The diff only shows the parts of the file that have changed, not the entire contents of the file.
Push your repository to GitHub using Github Desktop.
Currently, your repository only exists on your computer, and you’re the only one who can access the repository. Publishing your repository to GitHub keeps it synchronized across multiple computers and team members on the same project. To publish the repository, you’ll “push” it to GitHub, which makes it available on GitHub.com as well.
- Click Publish repository.
- You'll see a few familiar fields. "Name" and "Description" match the fields you completed when you created the repository.
- You'll see the option to Keep this code private. Select this option if you don't want to share your code publicly with other users on GitHub.
- The Organization dropdown, if present, lets you publish your repository to a specific organization that you belong to on GitHub. It's okay if you're not a member of an organization yet!
- Click Publish repository.
- You can access the repository on GitHub.com from within GitHub Desktop. In the file menu, click Repository, then click View on GitHub. This will take you directly to the repository in your default browser.