Skip to content

Instantly share code, notes, and snippets.

@vladdu
Last active August 29, 2015 14:06
Show Gist options
  • Save vladdu/7a87a19b12c568eb4d39 to your computer and use it in GitHub Desktop.
Save vladdu/7a87a19b12c568eb4d39 to your computer and use it in GitHub Desktop.
git pre-commit hook template: we need to work only with the files that are going to be commited
#! /bin/sh
git stash -u --keep-index
# .... work ....
# get only affected files with
git status --porcelain
#
git reset --hard
git stash pop --quiet --index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment