Getting started
Let’s start discovering GitHub by explaining a common usage scenario: you are editing your own project and using GitHub to save your changes.
Step 1 - Create a repository
A repository is used to organize a single project. Repositories will contain all the files needed for your MakeCode projects.
- Open the editor, create a new project
- Click on the GitHub button next to the Save button.
- Select a good name and description (it helps with internet searches!).
Sign in
If you haven’t signed in yet with GitHub, you will be redirected to the GitHub sign in page. On your first use of MakeCode, you will also be asked to authorize the Microsoft MakeCode with GitHub app. This integrates MakeCode with GitHub using our GitHub app.
Advanced users can use a developer token so that they can work directly with GitHub without having to sign in with the app.
If you don’t already have a GitHub account, you will need to sign up for one first.
Step 2 - Make code changes
Go ahead and make some changes to the code in your project.
Step 3 - Review your changes
Make any change in the code editor and you will notice that an up arrow is displayed
on the GitHub button. The arrow means that there are changes stored on your computer and they need to get saved to GitHub. Click on that button to open the GitHub view.
You will see the list of modified files and their differences, or diffs. A diff is common jargon used by developers to describe a formatted display of differences between two pieces of text (read about using diffs). Look at the diff carefully, it tells you which lines you added, deleted or modified.
Reverting local changes
If you do not like some of your changes, you can click on the Revert button next to the modified file. It allows you to undo all the changes in that file and roll it back to the content in the previous commit.
Step 4 - Commit & push changes
Click on the commit & push changes button to save these changes to GitHub. This will create a new commit in your repository. A commit is a bundled set of changes that can be uploaded to GitHub (read more about commits).
That’s it! Each time you want to keep a set of changes to your code, repeat steps 2, 3, and 4!