Skip to content

Instantly share code, notes, and snippets.

@stantonk
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stantonk/dfc0a8828a9b01e08b72 to your computer and use it in GitHub Desktop.
Save stantonk/dfc0a8828a9b01e08b72 to your computer and use it in GitHub Desktop.
Mercurial hg: Quickly squash a recent, unpushed commit with some un-committed changes. This is really handy when you forgot to do something, or a linter or CI suite catches errors before you push / merge.
#!/usr/bin/env bash
# N.B. requires patch queues (mq) enabled in your .hgrc. to finish this up
# and turn into a real commit, do `hg qfinish -a`
now=`date +"%s"`
patch_name='$now-temporary'
hg qnew $patch_name
hg qpop
hg qimport -rtip
hg qfold $patch_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment