Level Up Your Git with Git-extras: How I ‘Hack’ My Daily Command-Line Productivity

Git tutorial - IT technology blog
Git tutorial - IT technology blog

When Standard Git Just Isn’t Enough

At the end of every sprint, I usually find myself stuck in an exhausting loop: cleaning up dozens of old branches, manually updating the changelog, and answering my manager about which files are “hotspots” that need refactoring priority.

In reality, default Git is quite minimalist. To delete a branch both locally and remotely, you have to type at least two commands: git branch -d name and git push origin --delete name. Want to see team commit statistics? You’ll have to struggle with a complex set of git shortlog flags combined with grep or awk.

Even though I’ve used Git for a long time, I still find these repetitive tasks incredibly time-consuming. The DevOps guys at my place often joke: “Git was born to manage code, not to challenge a developer’s memory.”

Why Default Git Commands Can Be Difficult

Git was originally designed as a set of atomic commands. It provides the most basic building blocks for you to build your own workflow. However, this approach reveals several weaknesses in modern project management:

  • Lack of aggregation: Git is great at tracking lines of code but lacks a big-picture view of the repository (e.g., who contributes the most, which files change most frequently).
  • Clunky workflow: Many real-world tasks require combining 3-4 individual commands to get the job done.
  • Difficult to automate non-technical tasks: Creating a CHANGELOG file or managing release tags often requires additional external scripts.

Common “Manual” Workarounds

Before discovering Git-extras, my colleagues and I usually struggled with three methods:

  1. Manual commands: This is slow and extremely error-prone. One moment of distraction while typing a branch deletion command, and a whole day’s work could vanish.
  2. Configuring Git Aliases: My .gitconfig file used to be miles long with dozens of aliases like git co or git st. However, aliases are hard to use for complex logic or to share across the whole team.
  3. Using GUIs (SourceTree, GitKraken): These tools are visual but can be resource-heavy. Especially when you need to SSH into a server for an emergency fix, you can’t exactly open a graphical interface.

The Solution: Git-extras – A “Pro” Toolkit for the Terminal

After much searching, I stumbled upon Git-extras. This is a collection of over 170 helper scripts that transform complex tasks into short, simple commands for the terminal. Instead of writing your own scripts, you just install it and enjoy the results.

How to Install Git-extras

Installation is straightforward via popular package managers.

On macOS:

brew install git-extras

On Linux (Ubuntu/Debian):

sudo apt-get install git-extras

On Windows:
If you’re using WSL, install it like Linux. For pure Git Bash, you should use scoop:

scoop install git-extras

Practical Commands That Save Me 15 Minutes a Day

Here are the “golden” commands that I believe every developer needs.

1. git summary: Project Report in 1 Second

When taking over a new repo, instead of asking around, I just type git summary. This command outputs a statistics table: number of commits, most active authors, and the project’s age (e.g., 2 years, 3 months). It’s like a summary health report for the codebase.

2. git effort: Finding the “Hottest” Files

This command is extremely useful when planning a refactor. It lists files along with their corresponding commit counts. A file with a high “effort” score means it changes too frequently—a sign of a God Object or a potential bug hotspot.

git effort --above 10

The result will pinpoint files with more than 10 changes so the team can focus on optimization.

3. git delete-branch: Cleanup with a Single Command

Forget about typing deletion commands for both local and remote. With Git-extras, you just need:

git delete-branch feature-login

The system will automatically scan and wipe all traces of that branch in both locations. Fast and extremely safe.

4. git changelog: Say Goodbye to Manual Logging

This is my lifesaver every release cycle. Instead of digging through history from v1.0 to v1.1, I use:

git changelog --final

This command automatically aggregates commit messages and formats them into a professional CHANGELOG.md file. If your team follows Conventional Commits, the output will look fantastic.

5. git ignore: Quickly Blacklist Files

Coding and accidentally created a log or temp file? Instead of opening .gitignore and pasting the path, I just type git ignore "*.log". This helps me maintain my focus without being interrupted by trivial tasks.

Experience Applying This to an 8-Person Team

I encouraged the whole team to install Git-extras from day one of project setup. The result was a noticeable increase in branch management consistency. We no longer have “junk” branches sitting on the server for months.

A little tip: I often alias git summary to git s for a quick check every morning. Additionally, the git authors command is great for generating a contributor list for Open Source projects, recognizing everyone’s effort, no matter how small.

Conclusion

Git-extras doesn’t replace Git; it just makes Git friendlier and more powerful. If you work with the command line frequently, this toolkit will noticeably smooth out your workflow. Let Git-extras handle the grunt work so you can focus entirely on solving important logic problems.

Try typing git extras --help after installation. You’ll find hundreds of other interesting commands that could completely change how you work with Git every day.

Share: