Git Gud 001: Basic explanation & creating our first repo


(Hardware Bias!) #1

Now this is not a programming tutorial as most of you are probably hoping for, but I think most of you (if not all) ever had to use git. Wether it is to get involved in our Gitlab or to clone a nice little piece of software you found from GitHub, you’ll most likely use it in the future. I am currently learning git, so to learn it better I always find it a good idea to write about it to help me memorize it. And this is why I am writing these articles.

We will first manage a local repository, and then we’ll move on to managing code on Github later.

Everyone has their seatbelt on? Great, then ride along!

What is git?

According to Git itself:

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Now, what this basically means is that git is a program to manage file versions. Let’s look at it using an example. Say that you are writing a piece of software. Ohh look at that, you got a bug! No problem, it can happen to the best of us. You decide to fix it. And as usual, fixing one bug comes with 80828948673273833267797976 extra bugs. You decide to fix those 80828948673273833267797976 bugs, but you end up creating even more bugs! After fixing so many bugs, you are left with so many versions of your program that you can’t keep track of what you did anymore! Which one is the working one? Which one has the function you wanted?

Well, this is basically what git does. Git allows you to initialize your repository, then work on files without actually replacing them, and when you think they’re good enough you can commit them. And best of all, you can always revert back!

Take note that git is not exclusively for coders. I like to use it too to work on electrical schematics for example!

Explanation is not my strongsuit, so we’ll go jump in to explain it better


  • You are running any Linux distribution
  • You have git installed
  • You have some basic knowledge of Linux commands (touch, mkdir, cd, etc…)

Making our first repository

As I said earlier, the first part of this tutorial we’ll manage a local repository. But to do that, we’ll need to make a directory first to host our repo in, using mkdir. After that we’re gonna change into the newly created directory using cd, and then we’ll enter this command:

git init

git is the program we are running
init is short for “initialize”, and it tells git to start a new repository in our current directory (the directory can also be given using a parameter).

Now, when we enter git status, we see that git has nothing to commit. Obviously, because we didn’t enter any files yet!

However, something happened though. When we enter ls -la, we can see git made a file called .git, which is normally invisible. Don’t touch this file! This .git file basically tells git that this directory is a repo and it contains all the info about the repo, so you can give it to someone and they can immediatly start working with it out of the box. Deleting this file basically deletes your repo & your commitment logs (which we will talk about later).

Now, let’s make some files using the touch command, and run git status again to see what happens.

AHA! As you can see, git recognised we added 4 new files to the directory. Now we can start to add them to our staging area to finally commit them!

The End

So this will be the article for now. I know it is a short one, but I am short on time and I JUST HAD to upload something. In the next article, we’ll look at how to add files & commit them, aswell as changing them.

Stay tuned!


touch pry.txt
touch oaktree.txt
touch 0x00sec.txt

Looks like someone is riding the 0x00sec train kek.


(Command-Line Ninja) #3

No @IoTh1nkN0t… Hmmm. I’m tasting bias here @_py what do you think?



nice little article about local git management. Pretty easy so far.
When I first started using git this was no problem, but all that branch creating changing, local vs. remote stuff confused the shit out of me. Will be helpful for beginners if you will cover something like that in Git Gud 002.


(Hardware Bias!) #5

That is why I am not covering remote repositories right now. I first want to make sure I (and the readers) understand basic git use first.


(Command-Line Ninja) #6


Where’s number 2? Gotta give the people what they want!

(Full Snack Developer) #7

/me chants “workflow! workflow!”

(I have a lot of opinions on workflow)


@Phoenix750 woop woop woop give the masses what they deserve. :smile: :smile:

(Hardware Bias!) #9

This topic was automatically closed after 30 days. New replies are no longer allowed.