avatar
Use Git Like a Pro — Aliases, Tools, and Power Workflows
July 6, 2025
6 min read

Use Git Like a Pro — Aliases, Tools, and Power Workflows

⚡ Git Aliases: Speed Up Your Workflow

Typing git status a dozen times a day gets old fast. Speed things up with Git aliases:

git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.lg "log --oneline --graph --decorate --all"

📈 Pro-Level Aliases

git config --global alias.amend 'commit --amend --no-edit'
git config --global alias.undo 'reset HEAD~1 --mixed'
git config --global alias.recent '!git for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short) - %(committerdate:relative)"'
git config --global alias.cleanup '!git branch --merged | grep -v "*" | xargs -n 1 git branch -d'

🛠 Essential Git Tools

  • tig – A terminal UI for browsing Git history interactively.
  • Lazygit – Stage, commit, and resolve conflicts in seconds.
  • GitHub CLI – Run gh pr create and more right from your terminal.
  • Diff So Fancy – Prettier diffs that are easier to scan.
brew install lazygit
npm install -g diff-so-fancy
git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"

🎯 Advanced Git Features

🔀 Interactive Rebase

Clean up commit history before merging:

git rebase -i HEAD~4

🚨 Git Hooks

Automatically lint or format before committing:

# .git/hooks/pre-commit
#!/bin/sh
npm run lint

Make it executable:

chmod +x .git/hooks/pre-commit

📦 Stashing Like a Boss

git stash push -m "wip"
git stash list
git stash apply stash@{0}
git stash drop stash@{0}

⚙️ Git Productivity Tips

  • Auto-correct typos with git config --global help.autocorrect 1
  • Global .gitignore for OS/editor junk:
    # ~/.gitignore_global
    .DS_Store
    node_modules/
    *.log
    .idea/
  • Set with: git config --global core.excludesfile ~/.gitignore_global
  • Use modern commands: git switch & git restore

🖥 GUI + Visual Tools

  • VSCode Git UI – Clean and native Git integration.
  • GitLens – Advanced Git insights right inside VSCode.
  • GitKraken – A powerful Git GUI client for teams.

🚀 Best Practices for Git Workflow

  • Create a new branch for each task: git switch -c feature/login-page
  • Write clear, meaningful commits in imperative voice.
  • Pull with rebase: git pull --rebase origin main
  • Squash commits before merge: git rebase -i origin/main
  • Use git log --oneline to keep history readable.

📚 Learn More

Git isn't just a tool — it's a language. The more fluently you speak it, the faster and more confidently you'll build software.