git-interrupt
v1.0.1
Published
Safely context-switch urgent Git fixes with worktrees — no stash, no WIP commits.
Maintainers
Readme
Git Interrupt
No stash. No WIP commits.
Git Interrupt creates a clean worktree for an urgent fix, so the work you already have in progress stays exactly where it is.
Quick start
Install it once:
npm install --global git-interruptFrom the repository you were working in:
git-interrupt fix/loginWhen the fix is committed, run this from its worktree:
git-interrupt doneNo global install? Replace git-interrupt with npx git-interrupt in either command.
Stop stashing. Start fixing.
An urgent bug should not wreck the work you already have in progress.
Git Interrupt gives every urgent fix its own clean Git worktree. Your current branch, modified files, and untracked files stay exactly where they are. No stash. No WIP commit. No branch-switching anxiety.
The full workflow
You are deep into feature/payments. Twelve files are modified. Three are untracked. Then a login bug lands in your lap.
git-interrupt fix/loginFix the bug in the new VS Code window. Commit and push it as you normally would:
git add -A
git commit -m "Fix login failure"
git push -u origin fix/loginThen, from the interrupt worktree's terminal:
git-interrupt doneThe temporary worktree is removed. Your original workspace is still waiting for you, untouched.
What just happened?
your-project/ feature/payments + unfinished local work
your-project-fix-login/ fix/login + the urgent fixGit Interrupt creates the second folder using git worktree. Both directories share the same Git repository, but have independent branches and working files.
| Your current work | The urgent fix |
| --- | --- |
| Stays in its original folder | Gets a clean sibling folder |
| Keeps modified and untracked files | Starts from the latest commit (HEAD) |
| Is never stashed or committed by the tool | Gets its own branch |
Why use it?
Git already has the safe primitive: git worktree. Git Interrupt turns it into a habit you can use under pressure.
- No stash — nothing to forget, pop, drop, or accidentally apply on the wrong branch.
- No WIP commits — your history stays meaningful.
- No lost context — open the fix in a separate VS Code window and return to your original work exactly as you left it.
- No risky cleanup —
donerefuses to remove a worktree that has uncommitted changes.
Install options
Run it on demand with npx:
npx git-interrupt fix/loginOr install it globally if you use it often:
npm install --global git-interruptThen run:
git-interrupt fix/loginCommands
Create an interrupt worktree
git-interrupt <branch-name>For example, git-interrupt fix/login creates a sibling directory named <repository>-fix-login and a new fix/login branch.
Remove a completed interrupt worktree
Run this from inside the interrupt worktree after committing or otherwise cleaning all changes:
git-interrupt doneGit cannot change the directory of your parent shell, so the command prints the path of your original workspace for you to return to.
Safety promises
Git Interrupt never:
- runs
git stash; - creates a commit;
- modifies the original worktree;
- deletes a branch;
- removes a worktree with uncommitted changes.
It also refuses to overwrite an existing destination or reuse an existing local branch.
Requirements
- Git 2.5+
- Bash 3.2+ (already included with macOS)
- Optional: VS Code's
codecommand
Development
npm test