Home / News / Git Good: Aliases with Spice

Git Good: Aliases with Spice

What are you combo moves? Okay, maybe combo moves is the wrong word. But I like to think of common terminal combinations as combo moves because they help me WIN… at work! I like to have some fun with my shell and git aliases. Sometimes doing routine tasks can be a bore. Let’s bring more joy to your day-to-day development with really practical and SIMPLE upgrades to your workflow. Let’s git good at Git.

One of the tasks i do almost every day is use my terminal. Starting up development environments, spinning up Docker, and getting the latest and greatest from Git (yes, i don’t use a gitui for this).

So, one thing you can do is create aliases for your terminal to easily complete daily tasks. The issue sometimes if we forget which aliases we have available to us. We also tend to forget exactly what combinations of things our aliases are doing. Here are some simple tips to setting up fun, memorable Git aliases you will never forget.

What’s the frequency?

First, let’s check which aliases you use most often. A simple way to check this pressing ^to go through the list of aliases you are using. Another way you can look a bit longer list is going: history | tail This will get you the last 10 terminal commands you’ve used. Let’s use this list to find good names for each.

Here are some of mine:

git reset --soft HEAD~1
git stash apply
git push
git pull
git stash
git rebase development
git apply
git checkout -
git status
git reset --soft HEAD~1
git stash apply
git push
git pull
git stash
git rebase development
git apply
git checkout -
git status

There are two types of aliases we will focus on. The first is a Git alias. The second are shell aliases that can be set with something like Oh My Zsh.

Let’s pick a fun suite of names.

I have two younger brothers. They’re significantly younger; one is 8 years younger than me. They teach me words I would not have known otherwise. It’s kind of fun to learn though, and it’s convenient for this task. So let’s use some of that Gen Z slang to get stuff done!

Some of us have commitment issues.

Let’s face it. Some of us have commitment issues. We also probably all met some ambivalent people. “I want this, but I don’t want this. I want that too, and I cannot decide.” ARGH.

But sometimes, we feel like… my WORK. There are lots of ways to express that. We’ve messed up and want to fix it, but we do not want to remove all our progress. We want to salvage some of the work we have done. That is how I see this commonly used command:

git reset --soft HEAD~1

This command works wonders to undo a messed-up commit you commited. This is what you use when you think, “Ugh, yeah, that wasn’t the work I wanted to commit, but I want to continue working on it. I like a clean commit history on my branch that makes sense. So let’s make it make sense.”

I’m calling this one coldfeet.

So let’s set it:

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

Great, we’ve got our first command. Now whenever we are getting coldfeet, let’s call:

git coldfeet

That’s hard to forget, especially when there is a story involved with it. Let’s think about another similar one.

Let’s say we have commitment issues. We committed and regretted it, and want nothing to do with these new changes. We want to make them disappear. Well, the common command to undo your commit and get rid of your stuff is a long one. ugh.

git reset --hard HEAD~1

This one, sure you can use it a few times, and maybe you’ll remember it. But this is also a tougher one to use. If you use it incorrectly, you can accidentally remove work you didn’t mean to. So what does it remind us of? Well, what happens if you do this accidentally? We are WRECKED, or REKT. .

How about this?

git rekt
git config --global alias.rekt "reset --hard HEAD~1"

That’s easy to remember: if you use get rekt, you get wrecked.

This is why they pay us the Big Bucks.

Well, we talked a lot about when we aren’t ready to commit. But let’s talk about the more positive part of our workflow: when we get stuff done.

In our workflow, we often have work in progress we would like to commit, but we want to communicate that HEY DON’T LOOK at this yet. Hehe. However, say it’s important to keep track of the progress for whatever reason.

git config --global alias.meh "commit --no-verify -m 'wip'"

The work may BE MEH right now, especially if you’re like me and you’ve been employing the red, green, refactor method. That’s where the great-looking code comes at the end. 😉

So, Git meh is what I use for WIP commits. It’s easy, I can leave and come back, and it’s no issue.

Often, we need to revert our changes to a file, so there is a quick, easy one I like to use for that. And, the Git name for it is not very intuitive. Another mess up on the file? Let’s say we edited the names, but really we liked the original names.

git config --global alias.oops 'checkout --'
git oops names.json

What about when we are ready to commit? Our work gets the job done, it’s tested, and it looks beautiful. We applied all the techniques we’ve read in the great programming books. What now?
Well, that is what we get paid to do: write good, working code. So let’s use that.

git paidgit config --global alias.paid '!f() { git add . && git commit -m "$1" && git push; }; f'

So, let’s get paid.

Keep it updated.

Another frequent task is getting the local branch fresh with what’s in main. Well, for this one, I used a command that is a bit more complex. I like keeping my local branch up to date, so I do a combination of stashing and then calling something called

glowup

to make everything look GOOD.

So, we just open our file:

open ~/.zshrc

And, let’s look at my command for doing this.

alias glowup="echo '👟🧥💎 Starting git drip...'; git drip; echo '💧 Finished git drip!'; echo '💄👱🏻‍♀♻ Starting git reup...'; git reup; echo '💅♻ Finished git reup!'; echo '✨💅🏼💋 Glowup complete!'"

This already calls an existing command I have for getting the fresh changes. I call it:

git drip

.

drip = "!sh -c \"x=\\$(git symbolic-ref --short HEAD); git checkout development && git pull && git checkout \\$x\""

We want the latest and greatest looks for our branch. We want our branch to look and feel FRESH, so we get the latest drip. Admittedly, I had a hard time deciding between drip and drop. Should I honor gamer girl or fashionista? Well, in the end, I decided that drip fit the need better.

Avoid temptation.

These are just a few of the commands I use often. At first, I wanted to go wild with aliases — like every possible combo, meme, and mood. But honestly? I held back. I realized I don’t need 50 clever shortcuts, just 5–10 solid ones that make my daily flow smoother.

So, I kept my aliases pretty simple. They still give me room to pass in stuff when I need to. If your workflow is super consistent, you can definitely go for combo moves like:
command1 && command2 && … — that stuff can be powerful.

But don’t overdo it. Keep it clean. Learn what you’re actually running. Use it on purpose. And have fun with it.

For real — if you stay thoughtful about it, you’ll be owning Git.

The post Git Good: Aliases with Spice appeared first on Atomic Spin.

Tagged: