What is Github?

Introduction

From a birds eye view GitHub is a website with a software behind it. And it is aiming primarily at people developing software in an organized workflow.

But it is also a tool for e.g. Authors who work on a book. Or students writing a thesis. Or a bigger paper. It is that easy to use.

GitHub uses the concept of version control and more specifically it uses the software Git to achieve that.

Let´s dive a bit deeper to understand it better.

What is Version Control?

Version control is a concept where any kind of file gets a version assigned and it´s state is saved. Imagine you are working on the paper for your professor to pass your course. Or an image being worked on in Photoshop.

At any point where you decide this is a good state and you want to save it (imagine when you save your progress in a Computer Game). You use version control to give it a version number and make a state you can always go back to.

This is especially important in software development, where you have easily hundreds of files. And the code in them needs to work together perfectly or something breaks.

So whenever a feature is developed and stable, a “version number” is assigned and the state saved. This is then being “published”, so that other developers on the team can see and interact with it.

What is Git?

Git is one software that implements a certain way to do Version control. It uses 3 concepts:

  1. Repositories
  2. Branches
  3. Merges
  4. Commits (the versions)

What is a Repository?

A Git Repository is a folder with the files you are working on (text, images, source code, whatever (although text based works best)) and the structure Git uses to keep track of each file and each version.

What is a Branch?

A branch is a copied state with a beginning. Imagine copying a folder with files with a specific version. You can adjust them the way you want and you are independent of the other folder (mostly, there is a connection, but the example is good enough right now).

Basically you have one or more base branches (e.g. for software development you might have development, testing, release). And when you want to do a change you create a new branch (Git “copies” the folder), do your changes until you are happy or you want to throw them away.

If you want to throw them away you can just delete the branch and go back to the starting point.

If you are happy with your changes, you want to get them back into one of the base branches. To do that, you do a merge.

Let’s look at them next.

What is a Merge ?

As mentioned at the end of the previous section, you do a merge when you want to get your changes back into one base branch (e.g. release).

You do that with a merge. Virtually a merge is copying the new files of the second folder into the file of the first folder, overwriting the existing files and (!) keeping a history.

That’s basically it. Behind the scenes a lot more is going on, but that is the concept of a merge.

Of course in a team project with many people, a merge can be more difficult than when you work alone.

What is a commit?

Every time when you save a version of your files, the current status of each file is saved. In Git this is called a commit.

It contains the history (what was the status of each file before this update?) and the changes to get to the end result you just saved.

So, what is GitHub?

As mentioned in the introduction, GitHub is a website with Software behind it. That software is git.

Git works decentralised, so you can have the repository only local and be fine, if you are alone.

But in a group project, you still need some concept of a central place for the data. One single place of truths.

GitHub offers exactly that. They provide you with an easy to use website and storage for your repository. That makes synchronisation sooo much easier.

How does the GitHub interface look like?

Main View

What is GitHub?

This is how the main View of a single Project/Repository looks like.

You start with the Code Tab. There is the Tree from your repository, where you can navigation up and down around it.

You can see and switch the branches (where you see master, the git default branch when you create a repository). Click on it and you get a list of other branches.

When you click on 4 Commits, you go to a list of commits (statuses you saved) and for text files you can see what changed.

On the highest level of your repository, you can see the content of a readme.md, if you have one. It should contain all the information you need.

Could be the description, turn in date, resources and explanations for the paper you need to deliver.
Or the name of your customer, what it should be and the deadline for a design project.
Or in software development it often contains information how to run the software.

When you click on Pull Requests, you come to the next view.

Pull Requests

In What is a merge I explained to you that this is the name for the operation where you virtually copy over the content of the second folder into the first one.

GitHub uses the name Pull Request for that.

When you click on New Pull Request, you can start such an operation. You select the first and second folder and if everything is fine, you can just do it.

In Software Development this is a bit more complicated though.

What is a fork?

I include this for the software developers and programmers, as this mostly applies to you.

A fork is a copy of the Status at that time, into a new repository. The history usually stops at that time and changes are only in the new repository, not the old one.

In Open Source Software there are sometimes differences in opinion between people working together. When they can’t solve these, a fork is created.

These forks are often developing into different directions and do not come back together again.

But also sometimes when you want to contribute to a project they ask you to do a fork, make your change in your version and make a pull request to the original project.

How to use GitHub?

While explaining the interface, I basically told you how to use Github.

On a high Level you will:
1. Install Git on you Local Computer
2. Register a GitHub User
3. Create a Repository on GitHub
4. Clone that repository locally
5. Create a new branch each time you want to change something
6. Do your changes
7. Create a commit to save your state
8. Push your changes to GitHub
9. Merge your changes (“copied” them to the base branch)
10. Pull your updates locally

That’s it. Step 1 and 2 are usually only once, Step 3 and 4 once per project.
Step 5-10 you will do until you are happy with your result.

For a more extensive guide please read this article:

How to Authenticate?

Depending on the type of project where you use GitHub the authentication is more or less effort.

If you have only 1 GitHub account, it stays simple.

But if you have more, e.g. 1 personal and 1 for a company, you need to do a bit more set up.

Some Tools have a better integration than others. Personally I don’t like it when I have a good Tool but it has no or bad integration with GitHub. Plus I have more than one account.

So I decided to set it up in the right one once and the Tools don’t have to care about it anymore.
And setting up a new account is quick and easy too.

To see the details how to do it, please checkout this guide:

How to create a GitHub Repository ?

Open https://github.com/. When you are logging in, you see a list of your project/repositories.
In the top left of the GitHub Website you then find a Button New, next to Repositories.

Click on that button and the Create a new repository View opens.

Enter a name for your repository, choose the options you want and click Create Repository.

And boom, you have a new GitHub Repository.

How to clone a repository?

After you created your repository, you need to clone it (download the whole thing).

On a high level you do:
1. Find the address to your repository (Main View click Clone, copy address)
2. On your local computer run the commands to clone a repository (git clone $yourAddress)

Find more details in this article:

How to download a File from GitHub?

There are public repositories on GitHub. Maybe some of them have some information or files you need to get.

You can clone the whole repository and copy only that one file over that you need. Or you just want to download a single file.

Whatever you need, you find the details in this article:

How to delete a GitHub Repository?

Sometimes you need to delete a GitHub.

In short you:
1. Go to settings
2. Scroll down, click Delete this Repository
3. In the new view confirm that you want delete it and it is gone

You can not recover from that. And there are some more details related to it. So be sure to check out my Guide to prevent costly mistakes:

Wow, that is turned out to be quite an article. And still details are in more in-depth ones.

I hope you enjoyed it and that I was able to help you on your quest to understand what GitHub is and how you can use it.

Let me know what you miss and I will add it.

Best,

Frank

Leave a Reply