Skip to content

Instantly share code, notes, and snippets.

@elvisciotti
Last active November 13, 2015 16:25
Show Gist options
  • Save elvisciotti/627e0afd7ec1f570a668 to your computer and use it in GitHub Desktop.
Save elvisciotti/627e0afd7ec1f570a668 to your computer and use it in GitHub Desktop.
bash function to commit a message prepending the branch name
# gitcommit this message will be commited, with the branch name prepended
# e.g. (on branch feature01)
# > gitcommit this is the commit message
# > Committed with message "feature01 this is the commit message"
gitcommit() {
gm_branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p');
gm_commitMessage="${gm_branch} $@"
git commit -m "${gm_commitMessage}"
echo Committed with message \"$(git log -n1 --pretty=format:%s)\"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment