Github Desktop Cheatsheet
I want to get code from a repo onto my computer (Cloning)
Follow these steps if you need to get code from a Github repository onto your computer (for example to complete your coursework).
Github Desktop might look a bit different if are cloning the first repository on your computer.
Video
Instructions
- Open the repository on Github in your browser
- For most of your coursework this will likely be
https://github.com/CodeYourFuture/COURSEWORK_REPO_NAME
- For most of your coursework this will likely be
- Click the "Code" button, which opens a menu:
- Copy the URL (Pro Tip: you can click the clipboard icon on the right to copy automatically!)
- Open Github Desktop, and click on the File menu and then click Clone Repository:
- In the Clone Repository modal, make sure you are on the URL tab. Then paste the URL that you copied before into the "URL or username/repository" input:
- The "Local Path" input controls where the files will end up on your computer. You can probably leave it as the default
- Click the Clone button, and wait until it has finished cloning
Congrats! You have successfully cloned a repository from Github! 🎉
I want to open Visual Studio Code with code from my repository
Follow these steps if you already have the repository on your computer and you want to edit the files.
- In the menubar, click the Repository option
- Then click the Open in Visual Studio Code option:
Visual Studio Code will now open with the code from the repository.
I want to save my code to the repository (Committing)
Follow these steps if you have edited some code, and want to update the repository with your changes.
Video
Instructions
- Open Github Desktop and ensure you are in the correct Current Repository
- A diff showing the changes that you made is shown (lines with a green background were added, and lines with a red background were removed):
- Click on the files in the sidebar to see different files. Make sure that you're only changing files that you meant to change
- Once you're happy with your change, fill out the input boxes in the bottom left to add a commit message:
- Click the "Commit to main" button
You just committed your code to the repository! 🎉
You should now see "No local changes". You can now make more changes to the repository (and more commits), or you can push your existing commits.
I want to send my code to volunteers (Pushing)
Follow these steps if you have committed some code, and want to send it to the volunteers.
Video
Instructions
- Open Github Desktop and ensure you are in the correct Current Repository
- Click the "Push origin" button at the top:
The next steps are different depending on whether this is the first time you have pushed this repository to Github. If this is the first time you have pushed this repository, follow steps 3, 4 and 5 below. If not, you can skip those steps.
- If this is the first time you have pushed this repository, a message pops up asking if you want to fork this repository. Click the Fork this Repository button:
- A new message then pops up asking how you are planning to use the fork. Click the "To contribute to the parent project" option, then click Continue:
Click the "Push origin" button again
In the menubar, click the Branch > Show Pull Request option:
- This will open a tab in your browser. Click the "Create pull request" button on the right:
- Fill out the Pull Request title (it is helpful to include your city, name and which week the coursework is for):
- Click the "Create pull request" button
Congrats! You just created a Pull Request on Github! 🎉
The volunteers will now be able to review your code and give feedback!
TODO
- Glossary
- Tips on writing a good commit message?
- Tips on understanding a diff?