Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- local_branch="$(git rev-parse --abbrev-ref HEAD)"
- #branchPath=$(git symbolic-ref -q HEAD) #Something like refs/heads/myBranchName
- taskId=${local_branch##*/} #Get text behind the last / of the branch path
- firstLine=$(head -n1 $1)
- if [ -z "$firstLine" ] ;then #Check that this is not an amend by checking that the first line is empty
- sed -i "1s/^/#$taskId opis\\n/" $1 #Insert branch name at the start of the commit message file
- else
- if [ ! -z "$taskId" ]
- then
- sed -i "1s/^/#$taskId\\n/" $1 #Insert branch name at the start of the commit message file
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement