I am not sure why but I struggled with understanding how to use GitHub when I started out. It seems almost silly now.
I think one of the most important things is to understand the concept of git and why it is so useful.
Git is a version control system.
Simply put, it allows you to have access to multiple versions of a file as you save it throughout it’s lifetime.
For instance, say you have a file, you make changes it it and save the file to a specified location. You return to work on it a few days later, but this time you want to remove something and replace that data with something else. A few days on from this event, you realize that you needed the data that you had deleted, but you had save over your file so that data has been permanently overwritten.
This is also why we end up saving things like this:
Filename1 > Filename2 > Filename3 > Filename4
You either end up with a folder like this:
> MyFolder > Filename1 > Filename2 > Filename3 > Filename4
Or you would have a single file that you would overwrite to each time you save your changes:
> MyFolder > Filename
Either way there are negatives to both approaches:
- You can waste a lot of time sifting through your changes as there’s no easy way to find out the previous changes unless with a scripting language. If you have overwritten your file, it’s even more difficult to retrieve that information.
- The first approach would mean you end up using a lot of disk space than anticipated. I would imagine that you’d also need to have a separate way to track version control, otherwise you could get lost in the version numbers that you append to the end of the file.
As a version control system, Git keeps revisions straight, modifications are stored in a central repository.
Benefits of Git:
- Easy access for team working on the same project off the same files
- Persons involved in the project can contribute to the same repository and commit their changes.
GitHub is a central repository that can be made public or private. It can be shared with anyone and allow contributions. It is also commonly used as an additional tool to Resume/CVs as employers can see the work you have contributed to other projects as well as your own.
Getting started with GitHub – create your own repository:
Step 1 – Download GitHub
Step 2 – Go to File > New repository > give your repository a name
This is a contrived example, but let’s say you create a project where you will store your source files:
Once you make new changes to your project folder, GitHub will automatically detect the changes and ‘Push origin’ will appear on the top right which allows you to push your changes to GitHub. When you do this, GitHub will notify you if there are any clashes in modifications by different people to the same files. It will then give you the opportunity to review the changes and select the correct changes to commit to the repository.
I like to view my files directly within the repository. Note I am using GitHub to track changes on my personal projects. You may wish to use Git Bash to commit your changes without using a UI.
Did you find this useful? Let me know below.