What is Git?

The moment you start collaborating on code you will inevitably encouter “git”. Git is a version control system. That is the buzzword you might need for your application and interviews. This post covers the basic principle behind git, some very neat interactive tutorials and sources to deepen your knowledge on git.

What?

Version control is a mechanism that allows you to store the state of your code (snapshot) at a certain point of time and this mechanism also allows you to go back and forth between snapshots. The save points are called “commits“. The folder structure of your code with everything in it is a repository. You might come across Gitlab or Github. Those two are platforms that allow sharing repositories and collaborating on projects.

How?

So, when you are new to coding, you might be familiar with the way you did version control when – for example – writing a thesis or essay. You might have ended up like me:

Img.1 – Screenshot of three student’s homework files

When it comes to coding projects or even software, some low 2-digit KB will not be what you see. If platforms like Gitlab stored every file you have in a project at a certain point of time it would take up a lot of disk space. Thus, only the delta – the set of changes – between two snapshots is stored: the commit. Internally, more complex processes are going on but for a start this is enough for you to know as well as the fact that git refers a commit by its SHA-1 hash.

Under the hood, git actually builds up a tree-like structure of hashes referencing hashes to keep track of your and other’s work and to offer all the commands to “move backward and forward in time”.

If you are interested in gaining deeper knowledge I think Chapter 10 of the Pro Git book might be what you are looking for.

Learn it – geit good

Before I extend this post with explanations of branching, merging and rebasing, check out those two interactive tutorials/games. The first one is one I do on a regular basis: learngitbranching. I do it to refresh my knowledge because I tend to fall back to some few commands I use every time although there could be easier combinations or single commands. The tutorial is available in German as well, you only have to change the locale to “de_DE”.

https://learngitbranching.js.org/?locale=en_US

Learngitbranching runs in the browser and has short explanatory sequences on the various git commands. Afterwards you will play levels with increasing difficulty. The game itself works with presenting you a goal and you have to enter the right commands to reach that desired state.

Fig2. – Screenshot from “Learngitbranching” with status quo and goal to reach

Ohmygit is a downloadable and playable game. You have “cards” you can play to follow the instructions of each level, or you can directly type the commands. The levels are wrapped up with funny stories, so this tutorial is a bit more playful than the first one.

https://ohmygit.org/

Fig3. – Screenshot of level in the ohmygit card game

Further Reading

Posts created 14

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top