Skip to content

Instantly share code, notes, and snippets.

View evergosu's full-sized avatar
🐍
www.evergosu.dev

evergosu

🐍
www.evergosu.dev
View GitHub Profile

add git alias

open ~/.gitconfig

[alias]

time = !git status | grep 'git push' && EDITOR='vim -c wq' git rebase -i --autostash -x 'git commit --amend --no-edit --reset-author' && echo "updated timestamps" || echo "nothing to rebase"

modify cron

@evergosu
evergosu / prepare-commit-msg
Last active November 18, 2020 12:54
prepare-commit-msg
#!/bin/bash
FILE=$1
MESSAGE=$(cat $FILE)
TICKET=$(git rev-parse --abbrev-ref HEAD | grep -Eo '^(\w+/)?(\w+[-_])?[0-9]+' | grep -Eo '(\w+[-])?[0-9]+' | tr "[:lower:]" "[:upper:]")
if [[ $TICKET == "" || "$MESSAGE" == "$TICKET"* ]];then
exit 0;
fi
echo "$TICKET: $MESSAGE" > $FILE