Skip to content

Instantly share code, notes, and snippets.

@dietrichm
Created December 2, 2014 09:39
Show Gist options
  • Save dietrichm/d13c41cb82c15c9d1b23 to your computer and use it in GitHub Desktop.
Save dietrichm/d13c41cb82c15c9d1b23 to your computer and use it in GitHub Desktop.
Git commit with ticket name
function git-ticket {
if [ $# -ge 1 ]; then
local branch=$(git rev-parse --abbrev-ref HEAD)
local ticket=${branch##*/}
local msg="${ticket}: $1"
shift
git commit -m "$msg" "$@"
else
echo "Missing comment."
fi
}
@dietrichm
Copy link
Author

On branch ticket/FOO-123:

$ git-ticket "Some thing"

Commits as "FOO-123: Some thing".

Optional parameters at the end, e.g.:

$ git-ticket "Some thing" -a --dry-run

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