Skip to content

Instantly share code, notes, and snippets.

@das-g
Created March 11, 2015 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save das-g/0c66b2575a189a339e72 to your computer and use it in GitHub Desktop.
Save das-g/0c66b2575a189a339e72 to your computer and use it in GitHub Desktop.
script that can be used as git hook AND can be called manually
#!/bin/sh
GIT_DIR=${GIT_DIR:=$(git rev-parse --git-dir)}
GIT_WORK_TREE=${GIT_WORK_TREE:=$GIT_DIR/..}
cd $GIT_WORK_TREE
# Do something that depends on current working dir being the git work tree's root ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment