Why I’m Learning Git via the Command Line Interface

I’ve learned a bit about Git in the last year: I’m now quite comfortable creating and managing Git Repos in Azure DevOps. I frequently do demos with SQL Change Automation and  SQL Source control with Git on Redgate’s YouTube channel, and I’ve published a Git Cheat Sheet for the Command Line Interface.

I love learning Git now: I’m very comfortable with a small set of core commands which empower me to get a lot done and I’m able to regularly add new bits of knowledge into my repertoire.

I was interested in learning Git before, and I tried and failed to get started learning more than once. Each time, part of the problem was that I tried to use graphical tooling which I thought would make the whole thing simpler, but which I found to be difficult to start using – and also prone to quickly getting me into complex situations which I didn’t understand.

A big differentiator to me finally learning Git was embracing the built-in command line interface (CLI).

While command line interfaces are often harder to learn than graphical tools, in Git’s case I feel that it’s the opposite: the CLI helps you learn and focus. Here’s why:

  • You don’t need a lot: You mainly need to learn five or six simple, core operations which you will use 90% of the time – for everything else you’re generally going to use search engines and forum entries to figure it out case by case, anyway
  • It helps you learn: Mis-type a command? It will list commands spelled similarly.
  • Simple add-ins take away the toil:  Most of the pains I’ve had with Git have had to do with forgetting my current branch context, or not wanting to type out a whole command – add-ins like posh-git quickly solve these problems and let me have a simple-but-easy experience

There is still a case when I’m happy to depart from the command line: when it comes to merge conflicts, I’m all about having a graphic tool to help me sort out the mess. I’m a long-time fan of the editor Sublime Text, so I’ve recently been happily working with Sublime Merge (which allows you to try it out for free).

But for everything else Git, I love learning with the CLI.