Created
          October 20, 2024 09:41 
        
      - 
      
 - 
        
Save luc-tielen/2890b3a2403ca0ad3ed15ac5470eedaf to your computer and use it in GitHub Desktop.  
    Pre-commit hook for adding ticket to commit messages
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| set -e | |
| FILE=$1 | |
| MESSAGE=$(cat $FILE) | |
| TICKET=$(git rev-parse --abbrev-ref HEAD | xargs python3 -c 'import sys; print("-".join(sys.argv[1].split("/")[1].split("-")[0:2]))') | |
| echo "$TICKET: $MESSAGE" > $FILE | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment