Skip to content

Instantly share code, notes, and snippets.

@nitoyon
Last active August 29, 2015 14:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nitoyon/d99ad13d27721c42b964 to your computer and use it in GitHub Desktop.
Clean unstaged & untracked files in git repository with peco
function peco-select-git-restore() {
git status --porcelain | \
peco --query "$LBUFFER" | \
cut -f 2- -d ' ' | \
while read FILE; do
git clean -f -- "$FILE"
if [ -f "$FILE" ]; then
git checkout -- "$FILE"
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment