Should you learn Git in a GUI or the command line?
A common question I hear from Git beginners is:
“Should I learn Git in a GUI or in the command line?”
So let’s start by shortly defining what we mean by “Git GUI” and “Git Command Line”:
- Git CLI: CLI stands for Command Line Interface. You open a terminal, type commands and tell Git what to do. This is the default interface and the one you get when you install Git.
- Git GUI: GUI stands for Graphical User Interface. Git GUIs are programs that offer an interactive Git experience. You often get visualization of the state of your repository, commit history, and branches. Instead of writing your commands in a terminal, you can click on buttons and menu items. Git GUIs can be stand-alone applications like Github Desktop, Sourcetree, and GitKraken; Or they can be a part of a text editor or an Integrated Development Environment (IDE) like Visual Studio Code, Atom, and PyCharm.
Now, back to the question:
So which one should you learn first?
In my opinion you should learn Git CLI first. Here are 3 reasons why:
1. It’s the same everywhere
Git CLI is the same in all environments and on all machines. As long as you have Git installed, you have access to Git CLI. Same cannot be said of the GUIs. You might not be able to install them due to IT policies, or they might not be available for your operating system.
2. Access to all commands
Another benefit of CLI over GUIs is the completeness of the Git experience. All Git features are covered by the CLI. However, not all GUIs cover all Git features.
3. Easier to get help if you get stuck
You are more likely to get help online if you ask a question using the Git CLI terminology than using a specific Git GUI terminology. On top of that, most Git GUIs have bad or non-existing documentation.
Git CLI is not perfect though! There are areas where Git GUIs are superior to the CLI.
When it comes to visualization of branches and commit history, Git GUIs offer a more visually
pleasing and interactive experience. You can look at the commit history, you can click on each commit and
see what has happened in that commit, see who made it and so on.
The default output of
git log shown in the terminal can be hard to grasp for a beginner.
Luckily, you can make it more visually pleasing and easier to understand.
I wrote an article about it.
Another area where Git GUIs have an advantage is in showing diffs.
git diff shown in the terminal is sometimes hard to understand.
I personally prefer a side-by-side diff. I just open VSCode and look at the diff there.
Even with these two minor cons, I still suggest you learn to use Git in the command line first. Make sure you understand the basic concepts: cloning, staging, committing, checking out commits, branches, remotes, merging, and rebasing. Then, if you want to use a Git GUI feel free to do so. Just make sure you do not rely too heavily on it. Sooner or later, you will end up in a tricky situation with Git, and then the command line will be your only remaining friend.