Home Coding & Scripting Useful Git Aliases to Speed Up Our Workflow

Useful Git Aliases to Speed Up Our Workflow

220
0

⭐ Introduction

Git is one of the most powerful tools we use every day, but some commands are long to type and easy to forget. Git Aliases help us create shortcuts for frequently used commands so we can work faster, make fewer mistakes, and keep our workflow smooth.

This post lists the most useful Git aliases that every developer — beginner or expert — should know. They are easy to set up and make Git feel simpler and more enjoyable.


🧠 What Are Git Aliases?

A Git alias is like a nickname for a long command.

Example:

Without alias:

git status

With alias:

git s

Git will understand both.
You just type the shorter version and save time.

Aliases work in:

  • Git CLI
  • VS Code terminal
  • GitHub Codespaces
  • Linux, macOS, Windows
  • Dev Containers

Once added to your Git config, they work everywhere.


⚙️ How to Create a Git Alias

Use this format:

git config --global alias.<shortcut> "<full-command>"

Example:

git config --global alias.s "status"

Now typing git s will show the same output as git status.


🚀 Must-Have Git Aliases (Highly Recommended)

These shortcuts speed up your daily workflow instantly.


1. Check your Git status quickly

git config --global alias.s "status"

Use it:

git s

2. Create branches faster

git config --global alias.br "branch"

Use it:

git br

3. Switch branches easily

git config --global alias.co "checkout"

Use it:

git co main

4. Commit with a message quickly

git config --global alias.cm "commit -m"

Use it:

git cm "Initial commit"

5. View clean, readable commit logs

This is one of the most useful aliases.

git config --global alias.lg "log --oneline --graph --decorate --all"

Use it:

git lg

You’ll see a beautiful branch graph.


🔄 Helpful Aliases for Everyday Work


6. Add all changes quickly

git config --global alias.a "add ."

Use it:

git a

7. Pull with rebase (cleaner history)

git config --global alias.pl "pull --rebase"

Use it:

git pl

8. Undo last commit (safely)

git config --global alias.uncommit "reset --soft HEAD~1"

Use it:

git uncommit

This keeps your changes but removes the commit.


9. Stash and continue

git config --global alias.ss "stash save"
git config --global alias.sp "stash pop"

Use them:

git ss "temp changes"
git sp

10. See which files changed (simple view)

git config --global alias.df "diff --name-only"

Use it:

git df

✨ Bonus: Super-Productive Advanced Aliases

These are optional but powerful.


11. Show changes in a readable format

git config --global alias.d "diff --color"

12. View last commit quickly

git config --global alias.last "log -1 HEAD"

Use it:

git last

13. Clean up merged branches

git config --global alias.cleanup "!git branch --merged | grep -v 'main' | grep -v 'master' | xargs -n 1 git branch -d"

Use it:

git cleanup

🚀 Why Git Aliases Make You Faster

Using aliases gives you benefits like:

  • Less typing
  • Fewer mistakes
  • Cleaner Git history
  • Faster context switching
  • A smoother developer experience
  • Works on local machine, VS Code, and Codespaces effortlessly

Every second saved in Git adds up over weeks and months.


🎉 Conclusion

Git aliases are simple but incredibly powerful. With just a few lines of configuration, you can transform your Git workflow and make everyday tasks much faster.

Start with the basic aliases in this post, and add more as you discover what fits your style. Once you get used to them, you’ll never want to go back to typing long Git commands again.

Happy coding! 🚀

Previous articleProductivity Tips & Best Practices for GitHub Codespaces
Next articleUsing .gitattributes for Consistent Line Endings
Heartin Kanikathottu
As a seasoned Cloud and Security Architect, I’ve led transformative initiatives in key roles, including Vice President at Morgan Stanley, Principal Architect at Societe Generale, and Tech Lead & Cloud Security Architect at VMware, among others. I’m also an internationally published author with multiple books available on platforms like Amazon and O'Reilly. Notably, one of my books was recognized as the 8th best cloud computing book of all time in 2020, reflecting the impact of my contributions to the field. With over 15 professional certifications from providers such as Microsoft (Azure), Amazon (AWS), Oracle (Java), Pivotal (Spring), and IBM, I bring a wealth of expertise to my work. Academically, I hold dual Master’s degrees in Cloud Computing and Data Analytics. I’m passionate about sharing knowledge and mentoring others, which is why I actively speak at global technical forums such as Tech Opportunities Fest at Platform Calgary, Google's Kubernetes Meetup, Java User Group, Elasticsearch Meetup, and the Agile India Conference.

LEAVE A REPLY

Please enter your comment!
Please enter your name here