WIP Commits

Tags: git, development

Upgrade Your Git: WIP

If you’ve been a developer for a decent amount of time, you’re probably familiar with git; it’s the de-facto source control system for coders. RIP Mercurial, SVN, and the others.

You should have your own .gitconfig, so you should be pretty familiar with git. You should also probably know that “git-flow” is not the best thing.

So here’s an actual helpful piece of git-fu. Sometimes when you’re working you should take a break and just add everything to a temporary commit. This is what I call a “Work in Progress” or WIP commit. You do this especially when you’re in the middle of tryting something, and you need to take a left turn or when you get interrupted by something that would take you away from your current work.

The alias

Ok I’ve spent enough time hyping this up.

here’s the alias:

wip = commit -am "WIP"

That’s it! And you use it like this

git add ./
git wip

Assuming you’re at the root and your .gitignore is set up right.

If you’re like me you probably have a bunch of WIP’s. So you might want to add a little to your commits. Fortunately you can just do this

git wip -m "this is what I was doing"

and you’ll get the “WIP” message along with your new message. Pretty neat!

Don’t push WIPs to Main

If you’re making a lot of progress, and you’re working on stuff, then you should not push WIP’s to your main branch. They’re noisy and don’t tell you much, except that you were working on something.

Think of your commit history like a story - if you can cut out words like “I was doing work” then do that. If you don’t know about squashing, then maybe I can tell you more secrets:

git rebase HEAD~n -i

where n is the number of commits since Main. Please note, you probably shouldn’t do this on any branch that multiple people need - you’re rewriting history, which sounds way scarier than it is.

Feel free to squash your WIP’s, you have my permission