Developer Tooling Β· Β· 4 min read

Git Diff & Delta on Linux: Reading Code Changes Without GitHub Desktop

A complete guide to Git Diff and Git Delta on Linux to review code changes comfortably without GitHub Desktop.

If you’ve stopped using GitHub Desktop and moved fully to the terminal on Linux 🐧, mastering git diff is non-negotiable.

git diff lets you inspect what changed, where, and howβ€”directly from the command line πŸ’». Combined with Delta, it becomes clean, readable, and editor-like βœ¨β€”without any GUI.

πŸ“Œ This article covers:

  • πŸ”§ Git diff fundamentals
  • 🧠 Commands you’ll use daily
  • 🎨 Installing & configuring Delta
  • ⚑ A clean terminal-based workflow

🧠 1. What Is Git Diff (Delta)?

In Git, a diff (delta) represents the difference between two states of your code.

Conceptually, Git works in three layers:

πŸ“ Working Directory β†’ πŸ“¦ Staging Area β†’ πŸ—„οΈ Repository (Commit)

git diff allows you to compare changes between any of these layers πŸ”.


πŸ§ͺ 2. Essential Git Diff Commands

πŸ”Ή 2.1 View unstaged changes

git diff

Compares:

πŸ“ Working Directory vs πŸ“¦ Staging Area

Use this to:

  • πŸ‘€ Review code before staging
  • πŸ› Catch mistakes early

πŸ”Ή 2.2 View staged changes

git diff --staged
# or
git diff --cached

Compares:

πŸ“¦ Staging Area vs πŸ—„οΈ Last Commit

Perfect for double-checking before commit βœ….


πŸ”Ή 2.3 Diff a specific file

git diff app.py

Multiple files or directories:

git diff src/ tests/

πŸ”Ή 2.4 Diff between commits

git diff COMMIT_1 COMMIT_2

Example:

git diff HEAD~1 HEAD

πŸ–₯️ This replaces β€œCompare commits” in GitHub Desktop.


πŸ”Ή 2.5 Diff between branches 🌿

git diff main..feature/login

Or explicitly:

git diff main feature/login

Ideal for pre-merge reviews πŸ”Ž.


πŸ”Ή 2.6 Summary-only diffs

Only file names:

git diff --name-only

With status:

git diff --name-status

Example output:

M app.py
A auth.py
D old_utils.py

🎨 3. Making Git Diff Readable with Delta

Default Git diff output can be painful to read 😡. Delta upgrades it with:

  • 🌈 Syntax highlighting
  • ↔️ Side-by-side view
  • πŸ”’ Line numbers
  • 🧭 Keyboard navigation

Once you try it, you’ll never go back πŸ’―.


πŸ“¦ 4. Installing Delta on Linux

🐧 Ubuntu / Debian

sudo apt install git-delta

🏹 Arch Linux

sudo pacman -S git-delta

🎩 Fedora

sudo dnf install git-delta

Verify installation:

delta --version

βš™οΈ 5. Set Delta as the Default Diff Viewer

Enable Delta globally:

git config --global core.pager delta

Recommended settings ⭐:

git config --global delta.side-by-side true
git config --global delta.line-numbers true
git config --global delta.syntax-theme Dracula
git config --global delta.navigate true
git config --global delta.light false

πŸŽ‰ Now every git diff looks beautiful.


Edit global config:

git config --global --edit

Add:

[core]
    pager = delta

[interactive]
    diffFilter = delta --color-only

[delta]
    navigate = true
    side-by-side = true
    line-numbers = true
    syntax-theme = Dracula

[diff]
    colorMoved = default

🧠 This feels like a modern code review toolβ€”right in your terminal.


πŸ”„ 7. Daily Git Workflow (No GUI Needed)

A clean, safe workflow πŸ›‘οΈ:

git status
git diff
git add .
git diff --staged
git commit -m "feat: add login validation"
git push

Check recent commits:

git log --oneline --graph --decorate -5

⚑ 8. Useful Git Diff Aliases

Work faster with aliases 🏎️:

git config --global alias.d "diff"
git config --global alias.ds "diff --staged"
git config --global alias.dc "diff HEAD~1"

Usage:

git d
git ds
git dc

πŸ” 9. GitHub Desktop vs Terminal

GitHub Desktop πŸ–±οΈTerminal πŸ’»
View Changesgit diff
Staged Changesgit diff --staged
Historygit log
Compare Branchesgit diff main..feature

Terminal workflows are faster, scriptable, and customizable πŸš€.


🧾 10. Bonus: Inspect a Commit Directly

Latest commit:

git show HEAD

Specific commit:

git show <commit-hash>

Includes diff + metadata πŸ“Œ.


🏁 Conclusion

If you:

  • 🐧 Use Linux
  • πŸ’» Love the terminal
  • 🎯 Want full Git control

Then Git Diff + Delta is a must-have skill πŸ’Ž.

Once set up, code reviews become:

  • ⚑ Faster
  • 🧼 Cleaner
  • 🧠 More reliable than GUI tools