add new functions to for git

This commit is contained in:
Jakob Schürz 2023-03-07 00:29:40 +01:00 committed by Jakobus Schürz
parent 4969c361b8
commit df226ec695
2 changed files with 25 additions and 0 deletions

17
bin/git-change-author-info Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags

8
bin/git-mergedetachedheadto Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
DESTBRANCH=$1
git checkout -b tmp
git branch -f ${DESTBRANCH:-master} tmp
git checkout ${DESTBRANCH:-master}
git branch -d tmp
git commit -m "Merged detached head into master" .