Git Aliases for WIP (Work in Progress) Workflow

Create git aliases for saving and restoring work-in-progress commits. Quick way to snapshot your current state before switching contexts.

Workflow Aliases

Detailed Explanation

Work in Progress Aliases

The WIP pattern provides a quick way to save your current state when you need to context-switch. The pair of aliases works together:

[alias]
    wip   = !git add -A && git commit -m 'WIP'
    unwip = !git log -1 --format='%s' | grep -q 'WIP' && git reset HEAD~1

How wip Works

The wip alias is a shell command (prefixed with !) that chains two operations:

  1. git add -A stages all changes (new, modified, and deleted files)
  2. git commit -m 'WIP' creates a commit with the message "WIP"

This captures your entire working state in a single command.

How unwip Works

The unwip alias is a safety-conscious reverse operation:

  1. git log -1 --format='%s' gets the subject of the last commit
  2. grep -q 'WIP' checks if it contains "WIP"
  3. Only if the check passes, git reset HEAD~1 undoes the commit

The guard clause prevents accidentally undoing a real commit. If the last commit is not a WIP commit, nothing happens.

The WIP Workflow in Practice

# Working on feature A, but urgent bug comes in
git wip

# Switch to bug fix
git checkout hotfix-branch
# ... fix the bug, commit, push ...

# Return to feature A
git checkout feature-a
git unwip
# Continue where you left off

WIP vs Stash

Both wip and git stash save work in progress, but they differ:

Feature WIP alias git stash
Visible in git log Yes No (separate stash stack)
Includes untracked files Yes (with -A) Only with -u flag
Branch-specific Yes (committed to branch) No (global stash stack)
Easy to forget about Less likely (shows in log) More likely (hidden)

The WIP approach is preferred by many teams because it is more visible and harder to forget about.

Use Case

Use the WIP aliases when you need to quickly save your current work to switch branches for a code review, hotfix, or meeting demo. The unwip alias lets you seamlessly resume exactly where you left off without hunting through the stash stack.

Try It — Git Alias Builder

Open full tool