4 Tips to learn Git (version control) better from a highest-rated teacher

Anna Skoulikari
Javarevisited
Published in
6 min readAug 20, 2020

So who am I?

My name is Anna and I teach Git (version control) both on Udemy and on my own platform www.techjourneywithanna.com!

And here are some tips I have for people learning Git.

1. Build a mental model of how Git works

One of the most important things to do when learning Git is to build an accurate mental model of how it works.

I say accurate because a lot of times when we first learn Git we adopt an inaccurate understanding of it.

Let me explain with an example.

A lot of fresh Git learners at some point start learning about branches. And from the name and the numerous colourful diagrams online it is easy to understand that branches in Git are like tree branches.

But, this is not the case!

Branches in Git are simply pointers to commits.

To see this explicitly try this exercise.

Step 1: Go to any local repository on your computer

Step 2: Show all the hidden files so that you can see your .git folder (this is the folder that manages your repository). On a mac you have to hold down Cmd + Shift + . (dot). On a windows computer you will have to go into your settings to show hidden files. Then, look at the contents of the .git folder.

Step 3: Inside the .git folder look at the contents of a folder called ‘refs’. And then look at the contents of a folder called ‘heads’. Here you should have one file for each branch in your repository.

Step 4: Click into one of the files that represents a branch in your repository.

What do you see?

A commit hash!

Because like we said, branches are simply pointers to commits. And that is why each branch file simply stores the commit hash that that branch is pointing to.

So, building the right mental model of how the Git machine functions is essential to working with it smoothly. And that was my main focus when I was designing my course.

2. Master the Basics

Most of us when we first learned Git was taught the Git beginners mantra:

🎶git add git commit git push git add git commit git push 🎶

But did we really understand in depth what was happening?

Relearning Git was a very humbling experience for me because I had to go back to basics multiple times.

I was often embarrassed when I had to admit to myself that I didn’t REALLY know or understand some things (even after coding for months).

BUT! The minute I gave myself permission to be a complete beginner again and was humble enough to try to learn something from a blank canvas, amazing things happened! (And often I discovered I wasn’t the only one that had misunderstood something or didn’t really understand it.)

For example, many of us when we first learn Git think that commits store the differences between one version of our project and another.

But that is not the case. This is a false mental model to have.

Commits are like standalone versions of your project (or snapshots as they are often referred to).

Each commit basically stores within it every single file that was a part of that version of your project.

That is why when you check out a commit you are just looking at a different version of your project.

Excerpt from Git Bible — Pro Git by Scott Chacon and Ben Straub

3. Play around with Git and test things out yourself

One of the best ways to get comfortable with Git and to really make sure you understand it is to play around with it. And test out whether how you think things work is how they really work.

Let me share a story. I had come across this very common diagram online:

But then when I started tinkering around with Git I realized that this diagram was a bit misleading.

For example, you may know (or now you will learn) that another term for the staging area in Git is ‘index’. They are the same thing.

If you look inside the .git directory of any of your repositories (you can use the same one as you did in the first exercise) you will find a file called index.

This is your staging area (no need to look inside the file, it’s gibberish and beyond the scope of this article).

So actually the staging area is inside the .git directory. So it would be more accurate to make an annotation to the above diagram.

In order to build a more clear mental model of what was happening, I even went so far as to draw out a new diagram that would help me understand things better. And this is the diagram I used in my course in order to explain all the different parts of Git!

If you want an explanation of the different part of this diagram check out this video and this video.

So, take some time to try things out in Git and test out what you think you know this will help you gain a lot more Git confidence.

4. Take the time to learn from your struggles

You are at work and you come across a Git problem. Or you’re working alone at home and you find yourself in a sticky Git situation.

So you call out for help from those more experienced masters of Git (senior developers etc.).

They come.

They save you.

And you are back in safe waters.

This was basically me my first few months working as a developer. And what I wish I had done more often is asked my saviors to explain to me in depth what I had not understood. Or to have taken the time to study the situation independently. It would have made for a much smoother and more succinct Git learning journey!

That was it! I hope the above four tips help you with your Git learning journey!

If you are looking for an online course that teaches Git in a simple and accessible way then feel free to check my course out on Udemy or on my own platform www.techjourneywithanna.com!

You can also :

And, here is one of the sample lessons from Anna’s course — the difference between git and Github on Javarevisited Youtube Channel

--

--

Anna Skoulikari
Javarevisited

Anna Skoulikari teaches Git and recently published a book with O'Reilly titled: Learning Git - A Hands-On and Visual Guide to the Basics of Git