Skip to content

Instantly share code, notes, and snippets.

@MHolmes91
Last active March 8, 2018 19:04
Show Gist options
  • Save MHolmes91/64e85fc194f00956493441aae96ee0b9 to your computer and use it in GitHub Desktop.
Save MHolmes91/64e85fc194f00956493441aae96ee0b9 to your computer and use it in GitHub Desktop.
Add branch name to every git commit
#!/bin/sh
#
# Add branch name to every commit message.
BRANCH=$(git branch|grep '*'|sed 's/\* //')
echo "${BRANCH}: $(cat $1)" > "$1";
@MHolmes91
Copy link
Author

MHolmes91 commented Mar 8, 2018

Add this file (commit-msg) to your repository's .git/hooks folder to enable this functionality.

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