How to start using Git (with GitHub)

Kuba Czechowski
4 min readJul 11, 2021

The main object of this article is to provide you with knowledge that is required to kick off with using Git with GitHub. It’s a beginner friendly tutorial that introduces basic concepts. Later in practice section we will focus on executing operations using GitHub GUI — I believe its the easiest and most straightforward way to get started.

First of all: Why bother?

If you already know why, you can just skip these paragraph.

  1. GIT is great for collaboration in a team. Sending back and forth a folder with modified code may not be the most graceful solution, especially if you are working on a project at one time (what is the most common example).
  2. You can track history of changes in your code. If something did work but now doesn’t you can easily analyze what was changed and then make development project much easier and smoother.
  3. Show your work! Remember that book by Austin Kleon? Haha. Maybe in other article we will go to that. By contributing on GitHub ( Git != GitHub though) you can show that you are regularly learning and improving your programming skills. You can also upload your projects in which you show good understating of your tech stack. Another reason is that it’s just fun. Really!

Theory in a nutshell

Below we can see a small diagram. On a Sever Computer we store a remote repository. In our example it is stored on GitHub servers. We can say that this repository is a referential one — it means that Computer A and Computer B can only change or get last changes from only this repository. Computer A and Computer B don’t communicate with each other — every change must go through remote Server computer in order to be seen on other machine.

In the most common example: There is one and only remote repository (a place where a copy of your project is stored). However, there can be one or more local repositories. The number of local repositories is equal to number of contributors in the project. If you make a project in 3 people team then each member will have their own local repository.

Then we can introduce two commands:

  • commit — this command saves new changes. For example if we write “// this is a commit ” then this line will be saved to the history of changes. From now this change will be stored locally on our machine. In order to update remote repository with this change we need to use push command.
  • push — when this command is invoked all new commits are send to the remote repository and remote repository is being updated.

Now we know what to do to save a change as one extracted element and how to update remote repository with that change. Then we can introduce another two commands:

  • fetch — command checks if there are new commits in the remote repositories.
  • pull — command updates local repository with new commands if such exist.

How to do it in practice

I was searching a YouTube and came across a great video tutorial that explains step by step how to make your first GitHub contribution. Here I link tutorial made by Anson Alexander.

Here you will see how to:

  • set up your project and install GitHub desktop app
  • commit
  • push changes

After going though this tutorial you may ask questions “okay cool but how to collaborate with other developers?” “Aand .. how and use pull and fetch commands you mentioned?”

Firstly, you need to add collaborators. If you do so, they will receive invitations on their emails. Here is the way to invite collaborators: you need to go to project → settings → manage access → green button “invite collaborators

Then if other member in your team makes changes, you will see that in your desktop GitHub application after you fetch. Then you simply need to press a button to pull new commits from origin branch (branch that is in remote repo). You perform this operations by pressing button that is marked with red circle.

Summary

After this tutorial you should be familiar with committing and collaborating with other developers. Later after familiarizing with this tutorial you may want to learn about Git conflicts and other functionalities of Git.

--

--

Kuba Czechowski
0 Followers

I like to travel and drink coffee. Maybe cliché or maybe not. First year CS student.