Created
December 6, 2017 01:42
-
-
Save nbkhope/c3f18a617ba039a8bfb1c10f09650e20 to your computer and use it in GitHub Desktop.
Make a git commit including the issue number in the message
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
# Add this code to your ~/.bashrc (Linux) or ~/.bash_profile (macOS) | |
# Given a branch named with the pattern `feature/123456-some-branch`, | |
# makes a commit with the message "refs #123456 whatever" | |
# if called like `gc 'whatever message you want'` | |
gc() { | |
if [ "$1" == "" ] | |
then | |
echo "You must provide a commit message." | |
return | |
fi | |
issueNumber=$(git branch | grep \* | cut -d/ -f 2 | cut -d- -f 1) | |
git commit -m "refs #$issueNumber $@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment