I'd like to remove all wip references but current and send unused commits to garbage. But I found no specific wip commands for it. Should I use some combinations of generic git commands?

  • You're talking about Magit's WIP mode, aren't you?
    – user227
    Commented Dec 2, 2015 at 14:21
  • Yes. This mode creates additional references under .git/refs/wip
    – ayvango
    Commented Dec 2, 2015 at 14:22
  • By "send unused commits to garbage" do you mean that you want them to eventually be garbage collected, or do you want them to be completely removed now (losing the possibility to recover them from the reflog)?
    – tarsius
    Commented Dec 3, 2015 at 12:32
  • I want commits to be garbage collected eventually and I want refs to be removed immediately.
    – ayvango
    Commented Dec 3, 2015 at 14:41

1 Answer 1


Whenever you create a new commit on a branch, then the respective wip refs are reset to start at that new commit. From the perspective of the garbage collector the effect is about the same as if you deleted the wip refs and then recreated them. (Actually this does not happen right after creating a new "real commit" but only after additionally performing something that triggers an update to the wip refs, such as staging a change).

But since you mention that you also want to remove the wip refs themselves, not just outdated wip commits, I assume you want to stop using the wip modes altogether.

Unfortunately there's no Magit command to purge the wip refs. You'll have to use something like this instead:

git update-ref -d refs/wip/index/refs/heads/master

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.