Last active
July 5, 2018 08:28
-
-
Save pixmin/ed43f009d7bce1c45644f03a9cde4bce to your computer and use it in GitHub Desktop.
GIT Prepare Commit message with part of branch name
This file contains hidden or 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/sh | |
| # | |
| # Automatically adds Redmine task reference to every commit message. | |
| # Ex branch: dev-12345 | |
| # Will result in: | |
| # Refs #12345 [rest of commit message] | |
| # | |
| BRANCH_NAME=$(git symbolic-ref --short HEAD) | |
| BRANCH_NAME=$(echo $BRANCH_NAME | sed -e 's/dev-//g') # Remove "dev-" part | |
| BRANCH_NAME="${BRANCH_NAME##*/}" | |
| sed -i.bak -e "1s/^/Refs #$BRANCH_NAME /" $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment