aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-09-18 18:39:55 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-09-18 18:39:55 -0300
commitf0e0d0c74e29cbd7738092b3aa9824f206c3445f (patch)
treefdf80e2c0a642396c5a654f10444907ce3d19587
parent70beacc179ea415ea5db2a3bb7699c597709cb65 (diff)
downloadutils-git-f0e0d0c74e29cbd7738092b3aa9824f206c3445f.tar.gz
utils-git-f0e0d0c74e29cbd7738092b3aa9824f206c3445f.tar.bz2
Adding git-rewrite-identity
-rwxr-xr-xgit-rewrite-identity34
1 files changed, 34 insertions, 0 deletions
diff --git a/git-rewrite-identity b/git-rewrite-identity
new file mode 100755
index 0000000..fca9051
--- /dev/null
+++ b/git-rewrite-identity
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Rewrite identities in commits.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+OLD_EMAIL="$1"
+NEW_EMAIL="$2"
+
+# Syntax check
+if [ -z "$3" ]; then
+ echo "usage: $BASENAME <old-email> <new-email> <new-name>"
+ exit 1
+fi
+
+# Get new name
+shift 2
+NEW_NAME="$*"
+
+# Apply filter
+echo "Please run this command:"
+echo ""
+cat <<-EOF
+git filter-branch --commit-filter "
+ if [ "\$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ];
+ then
+ GIT_AUTHOR_NAME="$NEW_NAME";
+ GIT_AUTHOR_EMAIL="$NEW_EMAIL";
+ git commit-tree "\$@";
+ else
+ git commit-tree "\$@";
+ fi" HEAD
+EOF