Skip to main content


I have often come across questions from folks when they run into a problem such as, I accidentally deleted a file, pushed a secret to Github, merged a wrong branch, deleted a local branch, and tonnes of questions, and I have experienced these situations myself day in and day out. I always wanted to write a comprehensive guide that acts as a knowledge base that I can refer to at any point in my career. I hope this is that guide that will end all your git questions and help you git away with any git-related problems(Pun intended).

Who is this guide for?

If you are someone who is familiar with git and looking for a quick reference guide, you can jump to the Git Commands section which has all the git commands that you will ever need.

Who should learn git?

No matter what role you are working in tech, Whether you are a student, Freelancer, Open Source contributor, Volunteer, project manager, or someone who has just started to learn to write code. If you deal with writing code, you must know git. Even if you have never heard about it, in this guide I will share everything I have ever learned about git. Throughout my career, I have been making a note of all the git commands in this github gist But perhaps it really won't make sense to you unless you know how git works. This is the entire thing, I have ever learned to get away with 99% of the problems related to git. The remaining 1% is merely a learning for a lifetime. Rest assured I will continue to update this guide as I learn.

Why should I learn git?

I have seen people saving different versions of releases by date in different folders on their local computer, on Google Drive, but won't use git. It is like fighting the system to get the job done. The argument I hear is that it is difficult to learn, I need to buy a course on git, and I am a solo developer working on a project why would I need git? If you agree with that argument it simply means you don't understand git and don't fully utilize the resources available to learn. Let me give simple instances of why you would need it,

  • Imagine you are working on a project and  Your hard disk crashes (for whatever reason)
  • Your computer dies of power.
  • You accidentally deleted a file
  • Fixed a bug but silently broke a feature.

and the most common one "My code worked yesterday"

Now that you exactly know why you need git, let's get started with the basics of git.