This guide will step you through setting up GitHub and GithHub desktop and using it to manage different versions of your files / source code.
Creating an Account
Version control is essential for managing your project.
It allows multiple people to work on code and for changes that are made to files to be tracked.
Go to github.com and Sign Up
Fill in the details required
Creating a Repository
When you’ve signed in you’re going to want to create a repository.
A repository is a place where you store all of your files for a project.
Click New to create a repo
Fill in the details
You should make your repository private otherwise everyone can see your work
Working with others
If you are working with others you can add them to the repo
Then Manage Access
Click invite a collaborator and then type their username or email to add them
They will then have access to the repository
Installing the Github Desktop Client
Now we want to easily manage our work on our computers.
Download Github Desktop for this
Go to desktop.github.com/
And then Download and install the application
When installed you need to sign in and set it up
Click File Options
Click Sign in for Github.com
Now you’ll have the ability to create or clone your repositories
Cloning (Copying) a repository
This involves making a copy of the repository on your own computer to be able to use later.
As we’ve already created a repository online we’re going to clone it.
Clone means make a copy of the repository.
Click Clone a repository from the internet…
Next select the repository you want to clone
In the Local Path section choose where you want to save the project. Make sure that you know where this is. Any files saved into this folder will become part of the project.
Finally click the Clone button.
You will now see the repository
Adding Files to the repository
Go to the folder for the repository and save a file in there.
Now go back to Github Desktop
You will see that there is now a record in Changes
Green indicated content added since the last change and red indicated content deleted.
Github will track changes inside documents as well (so long as it can read them)
Committing changes to the repository
Now we want to commit (send the change) to the github repository.
Any commits we make need to have a summary title and should have a description entered.
See the example below for the Readme.txt file
Click commit to Master to commit the change locally (on this computer)
Next we need to Push (send the changes to the online repository), as this is the first time we have used the repository we also need to Publish the branch.
A branch is a separate path that our code can follow and can split off from other parts of the code at points (like a tree branch).
Click Publish brach (or push)
You should see at the top it says Pushing to Origin.
This means that the file is being uploaded
Making additional changes to files
Now open the Readme.txt file and edit it.
Save this change
Go back to Github Desktop and look at the changes
Add relevant comments to the commit
Commit the changes and push to origin
Viewing changes online
Note you can easily view the files on your computer from here or the online version
Click on the View on GitHub button. You might need to be signed in online for the link to work properly
Here we can see the project details
Making changes using Github.com
You can carry out basic editing in Github Online.
Click Go to File and then choose a file to edit.
If you can edit the file there is a pencil icon.
Click the pencil
Make some changes
Scroll down and Commit the changes
Syncing your local computer with the online repository
To check for updates in GitHub Desktop click Fetch Origin at the top of the window
If there are changes you’ll be asked to pull (download) the changes.
Open the file, you’ll see the updated version.
When there are changes on the local computer and online repository (conflicts)
So what happens when we change the online file and the local one at the same time.
Now change the online file and save the commit
Then edit the local file
Commit the change using GitHub Desktop
You should get an error
Fetch the remote commits
You’ll receive an error about conflicts
You can choose what to do with the conflict.
It’s best to open them in your code editor and manually merge the changes (even better if you prevent these problems). Visual Studio Code is a good tool for this.
Once you’ve resolved the conflicts you can Commit the merge
Sadly GitHub doesn’t really have a way of checking out and locking a single file so that others can’t access it.
Make sure you communicate with group members.