Rabbit using the command git diff --stat.
Thu Oct 22·Mihaela Jarema

Git (diff) and the plain ol' terminal

Why I still use the terminal for Git commands, `git diff` included.

IDEs, standalone GUIs, and the like often make our lives much easier when it comes to using Git faster and more intuitively. For instance, you can immediately spot which files changed, get much more readable diffs, or resolve conflicts more efficiently – often through simple point-and-click interfaces instead of looking up suitable Git syntax or drowning in a sea of text.

So should we still bother with typing Git commands in the plain ol’ terminal? Folk wisdom says there are many good reasons why we should use the terminal alongside our other tools. For instance, the terminal is something all Git users can access and learn to use with essentially the same effect everywhere – even in environments and tools different from those we are used to, where we might not yet be familiar with the specific skills they require. Also, typing commands in the terminal offers the flexibility to run exactly what we want, but not more – which can sometimes happen when we rely on GUIs (or AI) to do things on our behalf and clicking a button doesn’t map cleanly to the workflow we expect. If we’re not sure what has just happened in the tool we have just used, running git status and maybe git log will show us exactly how things stand – there is only one truth, as Detective Conan would put it.

That said, it can sometimes require some determination to wade through the output of Git commands at the terminal. Take git diff, for example.

> git diff
diff --git a/logo.bun b/logo.bun
index 403338e..140bf74 100644
--- a/logo.bun
+++ b/logo.bun
@@ -1,3 +1,3 @@
-   (\/)
- ( o . o )
-( (") (") )
+(\__/)
+(='.'=)
+(")_(")
\ No newline at end of file

Your eyes will be drawn to the + and - so you can probably grasp which hunks were removed, added, or modified; however, the hunk headers showing where the changes happened – and indeed the entire output – can be a bit of a thicket. And it doesn’t get easier when there are many more such entries. A side-by-side diff in an IDE or a GUI can make all this much more pleasant on the eyes.

Visual diff

And still, even for a command like git diff, larger changes can become more accessible in the terminal with the right flags in place. Add --stat to your git diff and Git will lay out a neat map of the impact of your changes, showing you where most of the changes occurred.

logo.bun          |  6 +++---
carrots.csv       | 10 ++++------
greens.csv        | 10 ++++------
3 files changed, 11 insertions(+), 15 deletions(-)

This is invaluable when these changes come from someone or something else, like something AI-generated, because it helps you know where to focus, even if you might inspect these changes side-by-side in an editor. Nothing like the terminal to give you that “pretty fly” kind of vibe.

Explore more posts about: