Add a load of handy ~/bin scripts

This commit is contained in:
2020-02-23 15:07:02 +01:00
parent 99fbfc42fe
commit 8032cee29c
13 changed files with 323 additions and 0 deletions

24
bin/git-rewrite-author Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
(( $# != 4 )) && { echo "$0 <repo> <oldmail> <newauthor> <newmail>" >&1 ; exit 1 ; }
_repo="$1"
_oldmail="$2"
_newauthor="$3"
_newmail="$4"
cd "$_repo" || exit $?
git filter-branch --force --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "'"$_oldmail"'" ];
then
export GIT_AUTHOR_NAME="'"$_newauthor"'";
export GIT_AUTHOR_EMAIL="'"$_newmail"'";
git commit-tree -S "$@"
elif [ "$GIT_COMMITTER_EMAIL" = "'"$_oldmail"'" ];
then
export GIT_COMMITTER_NAME="'"$_newauthor"'";
export GIT_COMMITTER_EMAIL="'"$_newmail"'";
git commit-tree -S "$@"
fi' \
--tag-name-filter cat \
-- --branches --tags