Skip to content

Instantly share code, notes, and snippets.

@rdarder
Created June 6, 2012 21:36
Show Gist options
  • Save rdarder/2884976 to your computer and use it in GitHub Desktop.
Save rdarder/2884976 to your computer and use it in GitHub Desktop.
export changed files on git index to a temp folder, useful for a pre-hook that does linting
tmpdir=`mktemp -d`
tree=`git write-tree`
git archive $tree \
$(git diff --cached --name-status |
grep -v "^D" |
awk '{print $2}'
) |
tar xv -C $tmpdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment