Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@L2G
Last active October 20, 2015 16:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save L2G/ce9272123a1b2bf57ac9 to your computer and use it in GitHub Desktop.
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)
#!/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
#!/bin/bash
${0%/*}/check-stgit.sh
#!/bin/bash
${0%/*}/check-stgit.sh
@L2G
Copy link
Author

L2G commented Dec 5, 2014

All of these files live under .git/hooks in a local repo. Don't forget to set the execute bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment