-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrewriteauthcommiter
61 lines (45 loc) · 1.77 KB
/
rewriteauthcommiter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
if ! [[ "`pwd`" =~ ^/tmp/.* ]]; then
echo "not in /tmp"
echo "bailing out..."
exit 1
fi
read -s -p "(1/2) Press Enter if you wanna rewrite the committer/author or else C-c"
echo
read -s -p "(2/2) Press Enter again if you wanna rewrite the committer/author"
echo
#src: https://stackoverflow.com/questions/4493936/git-could-i-change-my-name-and-surname-in-all-previous-commits
#using export here to be sure! (didn't test without it!)
export commiterName="ded"
export commiterEmail="[email protected]"
export authorName="$commiterName"
export authorEmail="$commiterEmail"
#git filter-branch --commit-filter \
#'if test "$GIT_AUTHOR_NAME" == "OldAuthor Name"; then \
#export GIT_AUTHOR_NAME="$authorName";\
#export GIT_AUTHOR_EMAIL="$authorEmail";\
#export GIT_COMMITTER_NAME="$commiterName";\
#export GIT_COMMITTER_EMAIL="$commiterEmail";\
#fi;\
#git commit-tree "$@"'
git filter-branch --commit-filter \
'export GIT_AUTHOR_EMAIL="$authorEmail";\
export GIT_COMMITTER_EMAIL="$commiterEmail";\
git commit-tree "$@"'
#FIXME: committer name is not changed!
exit 0
#what this does, example:
* commit 0a187cd5e605c23d9565a23e23f32135bbefbf85
Author: EmanueL Czirai <[email protected]>
AuthorDate: Wed Jul 16 08:10:13 2014 +0200
Commit: EmanueL Czirai <[email protected]>
CommitDate: Wed Jul 16 08:10:13 2014 +0200
Initial commit
changed to:
* commit bb928d37853a4bf39c1cec541c4eeb5f1a0d21da
Author: EmanueL Czirai <[email protected]>
AuthorDate: Wed Jul 16 08:10:13 2014 +0200
Commit: EmanueL Czirai <[email protected]>
CommitDate: Wed Jul 16 08:10:13 2014 +0200
Initial commit
#so for this reason(commit id changed!) I will not rewrite history! (6 june 2015)