Skip to content

Instantly share code, notes, and snippets.

@aristidesneto
Created September 22, 2023 16:08
Show Gist options
  • Save aristidesneto/6cac19d4e223afd83ff07c2b8633d6a1 to your computer and use it in GitHub Desktop.
Save aristidesneto/6cac19d4e223afd83ff07c2b8633d6a1 to your computer and use it in GitHub Desktop.

Revisions

  1. aristidesneto created this gist Sep 22, 2023.
    9 changes: 9 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/bin/bash

    BRANCH_NAME=$(git symbolic-ref --short HEAD)
    TICKET="${BRANCH_NAME##*/}"
    EXP='^[0-9]+$'

    if [ -n "$BRANCH_NAME" ] && [[ $TICKET =~ $EXP ]]; then
    sed -i.bak -e "1s/^/[ DSO-$TICKET ] - /" $1
    fi