From df226ec695994f46b77696e37dbc3df8aecb8d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Sch=C3=BCrz?= Date: Tue, 7 Mar 2023 00:29:40 +0100 Subject: [PATCH] add new functions to for git --- bin/git-change-author-info | 17 +++++++++++++++++ bin/git-mergedetachedheadto | 8 ++++++++ 2 files changed, 25 insertions(+) create mode 100755 bin/git-change-author-info create mode 100755 bin/git-mergedetachedheadto diff --git a/bin/git-change-author-info b/bin/git-change-author-info new file mode 100755 index 0000000..2516b39 --- /dev/null +++ b/bin/git-change-author-info @@ -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 diff --git a/bin/git-mergedetachedheadto b/bin/git-mergedetachedheadto new file mode 100755 index 0000000..d4fc900 --- /dev/null +++ b/bin/git-mergedetachedheadto @@ -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" .