Skip to content

Instantly share code, notes, and snippets.

@mkhl
Last active February 19, 2016 14:42
Show Gist options
  • Save mkhl/bb8760aeb7772421165c to your computer and use it in GitHub Desktop.
Save mkhl/bb8760aeb7772421165c to your computer and use it in GitHub Desktop.
#!/bin/sh
git add --update -- "$@"
git commit --message="trash -- $(date)" -- "$@"
git reset --soft HEAD^
git reset --quiet -- "$@"
git checkout -- "$@"
#!/bin/sh
git add --update -- "$@"
git commit --message="trash -- $(date)" -- "$@"
git reset --keep HEAD^
@mkhl
Copy link
Author

mkhl commented Feb 19, 2016

The -alt version preserves files added to the index that aren't trashed if you provide arguments. it would be a strict improvement if I can find sensible default arguments. Maybe git rev-parse --show-toplevel?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment