I don't know Git, but the Internet does

I don't think a day goes by where I am not adding, commiting, and pushing changes to one repository or another. Every week, I have to deal with some conflict after mergeing main into my branch or with figuring out which commit to cherry-pick to get a bug fix in my working branch. Yet, I also have to often recreate my work back on a fresh branch manually because of a failed reset -- hard or rebase, not to mention how many times I've tried to rely on my IDE for a merge and failed to properly resolve conflicts. Even after more than half a decade of using Git on a regular basis, I’d have a hard time answering some of the Git-related questions I see asked in interviews.

All this to say: Git is hard. Most jobs I applied to in the past had a requirement asking for something in the range of "Mastery of Git" and the interviewers often asked "So, how's your Git?". Given how important, and also how hard Git is, it would be hard not to be disillusioned with the technology. I would never dare say that Git can be made easy, but there are some tricks to be successful with it. Given how the topic of this second week of the writeathon is to share helpful tools and resources for developers, I'd like to share some for improving your Git skills.

All the resources shared here are free unless noted

Read the manual

I try to avoid telling someone to “go read the manual” at all costs when asked questions about pretty much anything. I have no problem saying that many linux man pages are excellent, like the bash manual for example, but I personally find them to be hard to get into if I don't have a basic understanding of what I am looking at. They are great information dumps, but I don't find them actionable when I am trying to get started.

This is not the case for the Git official documentation. It is beyond excellent, it includes a very well written tutorial and a list of the commands you need to get going in your everyday work, giving you the commands you should know as a solo developer or when working in a team. It's also written like a standard linux man page, which I've found very useful as a way to get into manual pages, which aren't always the easiest things to read. I personally cannot recommend the official docs enough; if you want to start using Git and get proficient with it, I'd recommend starting there. For once, "read the manual'' is a useful tip.

In the same vein, the tutorials by Atlassian on Git are also amazing. They have all the information you need to get started as a beginner, up to figuring out advanced concepts like Git LFS and the difference between merge and rebase. Most of their tutorials include visual aids to understand the many concepts of Git and how commits flow between branches. I have no relationship with Atlassian (I’ve never used any of their products) but believe me when I say that, if you're studying for interview questions on Git, the Atlassian tutorials are the way to go.

Quick guides

The official Git documentation can be a bit verbose, but the information contained there is very useful when you're trying to level up your skills. What if you want some resources that will get you to a working level real quick? For that, I highly recommend the simple-git guide. It has all the things you need to work in a team and ace those Git interview questions. It is well-written, to the point, contains some visual aids, and has a handy cheat sheet to print out so you don't need to refer back to the guide.

Even with these resources, it is very easy to mess up something when using Git, especially if you rely mostly on the command line. I certainly do almost every week. If you mess something up, the amazing "Oh Shit, Git!?!" (or "Dangit, Git!?!" for those who want a swear-free version, like my Canadian self) can get you very far. I often get lost on Google when trying to search for some way of repairing my errors, and this guide usually has a solution for my issues. The solutions are practical and teach you the use of those obscure Git commands I never see used, like git stash.

Learn by doing

Even with visual aids, Git can be a hard tool to wrap your head around. Git is surprisingly visual, a good graph can tell you all you need to know about your repository's history and how your branches flow around it.

Visualizing Git is a great tool for trying out Git commands and seeing how they impact the graph. Try a few commands in the editor and see what happens. It's particularly good at showing the differences between commands like merge and rebase thanks to animations of how rebase will move commits around when compared to merge. I can't recommend that tool enough if you have mastered the basics, but you need a bit of visual aid to fully explain what's happening.

If you'd like to learn with a visual aid from the start rather than rely on guides or manuals, the excellent Learn Git Branching will guide you through a visual tour of Git, with practical exercises to validate each lesson. If you feel the need to learn with pictures rather than words, this tool is one of the best. It's available in a slew of languages and gets to some very advanced concepts if you're interested in going above and beyond.

The Git Immersion tutorial is another very good learning resource. It is structured as a series of practical lab sessions and asks you to run the commands yourself. I've used it in university courses (both for teaching and learning) and I can attest to the qualities of its lessons. It's free, which is why I prefer it over something like a Udemy course.

GUI clients

There is nothing wrong with using GUIs when working with any technology, Git included. Don't let anyone tell you otherwise. You do need to understand the concepts to get going (and in case you get asked in an interview), but a GUI client can protect you against messing things up while making the busy work that much more straightforward. It can still be good to know your way around the CLI tool for the very advanced stuff, but if you're starting with Git, I'd highly recommend using a GUI client. There are a lot of GUI clients out there, I'll be sharing those I've used here, but this is only scratching the surface. Feel free to go to the official Git GUI clients page and choose the one you like best, or use your IDE.

On the side of open-source/free tools, GitHub desktop (GitHub only, also not available on Linux from their main website) is really good and there are some ways to get it working with other providers, like GitLab. I've had many colleagues who exclusively use GitHub desktop and we were able to collaborate without any issues. If you like the Atlassian approach to Git, they also make the excellent Sourcetree, also not available on Linux. They’re both really good tools backed by some of the bigger Git cloud providers out there. For Linux users like me, I'd also recommend Gittyup, which looks and works great.

If you're open to paying for your GUI client, I highly recommend Git Tower and GitKraken. Both are free for students through the GitHub Student Developer Pack. Tower has a 30 day license (but not Linux version) and GitKraken is free as long as you only connect to public repositories (and it has a Linux version!). Both are really good and the choice of which one to use depends on your budget and personal preference. I am on Linux, so the choice is obvious.

Conclusion

I hope these tips and resources will help you in your quest to learn or improve your Git skills. It's an essential skill for any developer/software engineer, but there's thankfully an impressive amount of (free) resources out there to help you out. I compiled some of the best resources here in this post, please let me know in the comments below if these were useful to you or if you know other resources you'd like to share. Happy coding!