GitHub Desktop for Beginners: Commit, Push, Branch, Undo

Version control without a single command: save snapshots, try wild ideas safely and take back mistakes.

FREE$34.95UpdateStar PremiumShare a link to claimThesis_final.docx, Thesis_final2.docx, Thesis_REALLY_final.docx. Every folder of a long-running project ends up looking like that sooner or later. Version control solves it properly: you save named snapshots of your work, jump back to any of them and try risky changes on a side track without touching the version that works.

Git is the tool most of the world uses for this, and its reputation for cryptic commands scares a lot of people off. GitHub Desktop wraps it in buttons and checkboxes. It's free, open source and works with GitHub as well as other Git hosting services. You don't need to be a developer: website files, scripts, notes in Markdown, game mods and config files all benefit. Version 3.6.10 is the current release.

Step 1: Install and sign in

Install GitHub Desktop from its UpdateStar page and sign in with your GitHub account when asked. A free account is all you need. Signing in lets the app publish your projects to GitHub later.

If you have no repositories yet, the app greets you with a Let's get started! screen offering four choices.

GitHub Desktop Let's get started screen with Create a New Repository on your Hard Drive highlighted The start screen (shown here on macOS, the Windows version has the same options).

Create a Tutorial Repository... walks you through the basics with a practice project, which GitHub recommends for your very first session. To start with your own project right away, read on.

Step 2: Create your first repository

A repository (repo for short) is just a folder whose history Git keeps track of.

  1. Click Create a New Repository on your Hard Drive....
  2. Enter a Name. It's used for the folder on your PC and later for the project on GitHub.
  3. Add an optional Description.
  4. Check the Local path. By default GitHub Desktop creates a GitHub folder inside Documents and puts your repo there as a subfolder.
  5. Tick Initialize this repository with a README. That creates a README.md file, a short description of the project, and makes the first snapshot for you.
  6. Leave Git ignore and License alone for now. Both are optional and can be added later.
  7. Click Create repository.

At the top of the window you now see the repository bar with three parts: Current Repository, Current Branch (usually main) and Publish repository. On the left sit two tabs: Changes shows what you've edited since the last snapshot, History lists all snapshots so far. You'll find the automatically created Initial commit there.

Step 3: Publish it to GitHub

Right now the repo lives only on your PC. Publishing copies it to GitHub, where it's backed up and available on other computers.

  1. Click Publish repository in the repository bar.
  2. Name and description are filled in already.
  3. Keep Keep this code private ticked unless you want the whole world to see your files. Untick it only for projects meant to be public.
  4. Click Publish Repository.

To check the result in your browser, open the Repository menu and choose View on GitHub.

Step 4: Make changes and commit them

A commit is one of those named snapshots. Edit a file in your repo folder, for example add a few lines to README.md, and save it. You can open the folder in your editor straight from the app via Repository > Open in EDITOR (the menu item shows the name of your configured editor, such as Visual Studio Code or Notepad++).

Back in GitHub Desktop, the Changes tab lists the edited file. Click it to see a diff: added lines in green, removed ones in red.

GitHub Desktop Changes tab with a changed README file and the commit summary field The Changes tab. The checkbox decides what goes into the commit, the summary field names it.

  1. Make sure the checkbox next to each file you want in this snapshot is ticked. Untick files that aren't ready yet.
  2. Type a short summary in the field next to your profile picture, such as "Add project description". Write it so that future you understands it in six months.
  3. Optional: add more detail in Description.
  4. Click Commit to main (the button always names the branch you're committing to). With the cursor in the summary field, Ctrl+Enter does the same.

Good habit: commit small and often. One commit per logical change makes it much easier to find and undo a specific step later.

Step 5: Push to GitHub

Committing saves the snapshot on your PC only. To send it to GitHub, click Push origin in the repository bar, or press Ctrl+P. A small number next to the button shows how many commits are waiting to go up. "Origin" is simply Git's name for the copy of your repo on GitHub.

Working on a second computer? There, Ctrl+Shift+P pulls the latest changes from GitHub so both machines stay in sync.

Step 6: Try ideas safely on a branch

A branch is a parallel version of your project. You can experiment there as much as you like while main stays untouched. If the idea works, you merge it back. If it doesn't, you delete the branch and nothing happened.

  1. Click Current Branch and then New Branch, or press Ctrl+Shift+N.
  2. Type a name under Name, for example "new-layout".
  3. Under Create branch based on..., pick the branch to start from (usually main).
  4. Click Create Branch.

Your commits now land on the new branch. Click Publish branch to put it on GitHub as well.

To switch, click Current Branch and pick another one. If you have uncommitted changes, GitHub Desktop asks what to do with them: Leave my changes on the current branch or Bring my changes to the new one, then Switch Branch.

Happy with the experiment? Switch back to main and press Ctrl+Shift+M (Merge into current branch) to pull the work over. Done with a branch? Branch > Delete... (Ctrl+Shift+D) removes it. Deleting a branch can't be undone, and branches tied to an open pull request can't be deleted at all.

Step 7: Undo a mistake

Each kind of oops has its own button, and you never need to type a Git command.

GitHub Desktop Undo button next to the most recent commit The Undo button sits right below the commit area as long as the last commit hasn't been pushed.

Committed too early, not pushed yet? In the Changes tab, click Undo at the bottom of the sidebar. The commit disappears, but your edits come back as uncommitted changes, so you can fix them and commit again.

Typo in the last commit message? Go to History, right-click the most recent commit and choose Amend commit, fix the Summary and click Amend last commit. Do this before pushing: amending replaces the commit, and a pushed one would need a force push.

Already pushed? Then don't rewrite history. Go to History, right-click the commit and choose Revert Changes in Commit. GitHub Desktop creates a new commit that cancels out the old one, and both stay in the history. If you revert several commits, go from newest to oldest to avoid conflicts.

Edits you want to throw away before committing? Select the files in the Changes list, right-click and choose Discard Changes, then confirm in the Confirm Discard Changes window. GitHub Desktop saves the discarded changes in a dated file in the Recycle Bin, so you can still rescue them until you empty it.

Our verdict

GitHub Desktop is the gentlest way into version control for writers, hobby coders, website tinkerers and anyone tired of "final_v7" file names. Today, create one repository for a project you're already working on, commit the current state and push it. From then on, every mistake is just one Undo or Revert away.

Related on UpdateStar

about author