Last active
October 20, 2015 16:17
-
-
Save L2G/ce9272123a1b2bf57ac9 to your computer and use it in GitHub Desktop.
Git hooks I use to avoid shooting myself in the foot with Stacked Git (StGit)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Look for an executable named "stg" and assume that it's StGit | |
STGIT=$(which stg) | |
if [[ ! -z $STGIT ]]; then | |
if [[ -x $STGIT ]]; then | |
if ($STGIT top >&/dev/null); then | |
echo "*" | |
echo "* Whoa there!! You have at least one StGit patch applied:" | |
echo "*" | |
$STGIT series | sed "s/^/* /" | |
echo "*" | |
echo "* If these patches are safe to include in the push, turn them into commits" | |
echo "* first (stg commit -a)." | |
echo "*" | |
echo "* Otherwise, please pop them off the stack (stg pop -a)." | |
echo "*" | |
exit 1 | |
fi | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
${0%/*}/check-stgit.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
${0%/*}/check-stgit.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All of these files live under
.git/hooks
in a local repo. Don't forget to set the execute bit.