Skip to content

Instantly share code, notes, and snippets.

@deadlocked247
Last active May 13, 2016 20:20
Show Gist options
  • Save deadlocked247/fd1188b6e275926b87fbf8993ae53d0e to your computer and use it in GitHub Desktop.
Save deadlocked247/fd1188b6e275926b87fbf8993ae53d0e to your computer and use it in GitHub Desktop.
Automatically add branch names before commit messages via hooks
#!/bin/bash
find vendor -name ".git*" -type d | while read i
do
if [ -d "$i" ]; then
DIR=`dirname $i`
rm -fR $i
git rm -r --cached $DIR > /dev/null 2>&1
git add $DIR > /dev/null 2>&1
fi
done
#!/bin/sh
BRANCH=`git branch | grep '^\*' | cut -b3-`
FILE=`cat "$1"`
echo "$BRANCH $FILE" > "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment