May 16, 2019

A super easy way to learn Git


When I first started out learning to code I decided that making my own projects as I went along would be a good way to ensure I could always put what I was learning into practice.

I had heard a lot about Git in passing but didn't really understand how it worked, what it was and why I needed to use it. Now I wouldn't be without it and can't believe I wrote an entire PhD thesis without a commit history and pushes to the cloud!

What is git?

Git is a version control system for your codebase. It allows you to see a history of the changes you've made to your code during the project. This makes it easy to travel back in time to a point before you completely ruined your code for example (possibly talking from experience...). Your code is stored in a repository on your computer but you can also (and should) store it in a hosted repository such as Github or Bitbucket incase your computer dies. Having it available online is also very handy for sharing your work with others - this is pretty much how most open source projects work. Its also great for teams as you can have multiple 'branches' in the code.

So how do I use it?

Git works on the command line. You type commands into a terminal to commit, push and branch your work. An example Git command might be:

$ git commit -m 'Initial commit'

Once you've got the hang of Git these commands are easy enough but for someone just starting out with very limited experience working on the command line, it can be very daunting.

Enter Gitkraken!

I was shown this tool really early on and I swear its the reason I learned to love Git. Its basically just a friendly UI that makes using Git much easier. So instead of typing your commands and trying to decipher the somewhat confusing responses, everything is laid out really clearly with easy-to-use buttons.

Gitkraken page example

This is a very basic example with a single branch (master). Note the handy buttons at the top for pushing, pulling etc. My favourite thing about this tool however is the ability to clearly see your history. I can glance at this and see that I did some work on this 9 months ago, had a 6 month break and then started playing with it again. I can also see that my commit comments need work... 'massive update' is certainly not the best description of the changes made!

And its free (for non-commercial users).

Git is open source and so totally free. Github is free for most users too, they've even made private repositories free for everyone now as well.

Gitkraken is free for non-commercial use. So if you're just making your own private projects to practice its perfect. And to be honest, the paid tier is an absolute bargain anyway (about $4 a month) so if you find it saves you time and stress its probably worth it. I'll be investing in the paid option going forward as I start to do freelance work as although I can now use Git without it, it just saves a bunch of time for me. My husband uses it too despite years of experience with Git - its just handy!

Go have a look:

(I am in no way associated with Gitkraken I just think its an awesome tool!)