Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
16 lines (14 loc) · 595 Bytes

File metadata and controls

executable file
·
16 lines (14 loc) · 595 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
# Automatically adds ticket number to every commit message.
# Ticket number is extracted from branch name.
#
# See: https://gist.github.com/jimschubert/9073276
COMMIT_MESSAGE_FILE=$1
COMMIT_MESSAGE=$(cat "$COMMIT_MESSAGE_FILE")
# Don't apply this logic if we are in a 'detached head' state (rebasing, read-only history, etc)
# newlines below may need echo -e "\n\n: (etc.)"
BRANCH_NAME=$(git symbolic-ref --short HEAD)
if [[ "$BRANCH_NAME" =~ ^CC-[0-9]+/. ]]; then
TICKET=$(echo "$BRANCH_NAME" | cut -d "/" -f 1)
echo "[$TICKET] $COMMIT_MESSAGE" > "$COMMIT_MESSAGE_FILE"
fi
Morty Proxy This is a proxified and sanitized view of the page, visit original site.