DevOps & Platform Eng

Git Commands Developers Actually Use Daily

Ten years of Git, and most developers still live by a handful of commands. We’re cutting through the noise to reveal the core tools that actually get work done.

A developer's hands typing on a keyboard with Git commands visible on a terminal screen.

Key Takeaways

  • Most developers use a surprisingly small subset of Git commands regularly.
  • Aliases like `gst`, `glola`, `gd`, and `gds` are crucial for daily workflow and code reviews.
  • Newer commands like `git switch` and `git restore` offer safer alternatives to `git checkout`.
  • Workflow enhancements like `--fixup` with `rebase --autosquash` and `git-absorb` drastically improve commit history management.
  • `git worktree` provides a powerful solution for managing urgent tasks without disrupting current work via stashes.

Consider this: If you’ve been wrestling with Git for a decade, the chances are overwhelmingly high that you’re still only touching a fraction of its vast command set on a daily basis. The sprawling, comprehensive ‘Pro Git’ book, while a masterpiece of documentation, frankly doesn’t survive contact with the messy reality of a typical Tuesday. What does? A small, incredibly boring, yet ruthlessly efficient, set of commands, punctuated by a few less-frequent power tools that would leave a gaping hole if they vanished.

This isn’t about obscure workflows or commands you’ll use once a year. This is about the actual keystrokes. The muscle memory. The bread and butter of turning code into a shared reality.

The Daily Grind: Essential Git Aliases

These are the commands that live between every other command, the ones that become as natural as breathing. If you’re not already wielding these eight, prepare for a productivity jump. The aliases are drawn from the popular oh-my-zsh git plugin, but the full command is provided for portability.

gst

This is your sanity check. Branch status, upstream tracking, staged and unstaged changes, untracked files – all laid out in seconds. It’s the digital equivalent of a quick glance in the mirror before heading out the door. If there’s only one alias to adopt, make it this one. It costs nothing and prevents so much.

glola | head -30

Forget the linear view. glola gives you the graphical representation of your commit history, complete with branches and remote tracking. Piping to head -30 is key; rarely do you need more than the most recent commits to understand the project’s immediate past. This is the narrative of your project, distilled.

gd # what's changed but not staged
gds # what's staged and about to be committed

gds is the ritualistic pre-commit step. What are you actually committing? And gd helps you understand what you’ve tinkered with but haven’t finalized. Using git-delta as your pager (brew install git-delta then pager = delta in ~/.gitconfig) transforms the output from something to endure into something to understand.

gcam "fix: trailing slash in webhook URL"

For the quick, atomic fixes that pepper development. For anything more substantial, dropping the -m flag allows your $EDITOR to open, facilitating a proper commit message with context and a descriptive body. This isn’t just about recording changes; it’s about building a coherent history.

gpsup

This alias handles the initial push of a new branch, automatically inferring the branch name. Once upstream is set, a simple gp (or git push) suffices. It’s about removing friction from a common, albeit initially verbose, operation.

gco main # switch to main
gco - # switch to previous branch
gcb feature/login # create + switch to new branch

The star here is gco -. It’s the cd - equivalent for your branches, an invaluable shortcut when you’re rapidly context-switching between two active lines of development. A single keystroke to hop back and forth.

gpf

Post-rebase or amend operations, this command is your safeguard. Crucially, always use --force-with-lease, never --force. The former prevents overwriting someone else’s work if they’ve pushed to the branch since your last fetch. In 2026, --force is an invitation to chaos.

gfa

This command refreshes all remote tracking branches and prunes deleted ones. Running gfa before starting any significant work ensures you’re operating with an accurate understanding of the shared repository state. The --prune flag is essential for keeping your local view clean and up-to-date.

The Weekly Wonders: Beyond the Daily Ticks

These are the commands that aren’t etched into daily muscle memory, but their absence would be acutely felt. They represent strategic moves rather than tactical ones.

git switch main
git switch -c new-feature # create + switch
git restore --staged file.txt # unstage
git restore --source=abc123 file.go # restore single file from any commit

The introduction of git switch and git restore fragmented the old git checkout into more specialized, safer operations. restore --source=<sha> <path> is particularly powerful, allowing you to selectively pull a file from any prior commit without disturbing your current working directory. It’s surgical intervention for your repository.

git commit --fixup=abc123 # fixup commit targeting abc123
# ... keep working ...
git rebase -i --autosquash main # all fixups slot into place automatically

This workflow is, quite frankly, a revelation for maintaining clean PR histories. Found a bug in a commit from a week ago? Instead of amending or creating a separate “fix bug” commit, use --fixup. Git intelligently places this new commit precisely where it belongs during an autosquash rebase. The result? A narrative history, not a chaotic ledger of mistakes and corrections.

Enter Git Absorb

For an even more streamlined fixup experience, git-absorb (brew install git-absorb) analyzes line changes and automatically determines the correct commit to fixup. The workflow simplifies to:

# edit files to fix the bugs
git absorb --and-rebase
# done.

It’s so intuitive, you’ll wonder why it’s not a native Git feature.

git reflog
git reset --hard HEAD@{5}

The reflog is Git’s safety net, meticulously recording every change to HEAD. A botched rebase, an accidental branch deletion, a reset --hard to the wrong commit – the reflog offers a clear path to recovery. It’s an underutilized lifeline for even seasoned developers.

git worktree add ../proj-hotfix hotfix/prod-down
git worktree list
git worktree remove ../proj-hotfix

This is the antidote to the dreaded Git stash when you need to jump onto an urgent hotfix without derailing your current feature branch. worktree add creates a separate working directory, linked to your main repository, allowing you to checkout and commit to a different branch simultaneously. It’s invaluable for tasks like reviewing a colleague’s Pull Request without disturbing your own context.

git config --global alias.recent \n"for-each-ref --sort=-committerdate --format='%(autolink:refname) %(authorname) %(committerdate:relative) %(subject)' refs/heads/"

While not a command you type daily, git config --global alias.recent ... sets up a shortcut to list local branches sorted by commit date. It’s a simple but effective way to quickly survey your active development lines.

This curated list isn’t about mastering every Git command; it’s about mastering the ones that reliably move projects forward. The true power of Git isn’t in its breadth, but in the depth of understanding and application of its core utilities.


🧬 Related Insights

Priya Sundaram
Written by

Engineering culture writer. Covers developer productivity, testing practices, and the business of software.

Worth sharing?

Get the best Developer Tools stories of the week in your inbox — no noise, no spam.

Originally reported by dev.to

Stay in the loop

The week's most important stories from DevTools Feed, delivered once a week.