Skip to content

Instantly share code, notes, and snippets.

@nitoyon
Last active August 29, 2015 14:21
Embed
What would you like to do?
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