I use this script to change author for specific commits:
#!/bin/sh
git filter-branch --env-filter '
NEW_NAME="MyName"
NEW_EMAIL="my-name@my-domain.com"
if [ "$GIT_COMMIT" = "afdkjh1231jkh123hk1j23" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
export GIT_AUTHOR_NAME="$NEW_NAME"
export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
from Change commit author at one specific commit
After run on main repo, all commits was duplicated with different hash and commit with hash 'afdkjh1231jkh123hk1j23' was duplicated with another hash with the specified name and email. Can I return to the original log?
The problem is: now, after each commit is generated a new commit with merge with previous commit.
For example:
last commit was 601dd3a...
after run script
last commits:
commit 1550a7c596...
Merge: 601dd3a 4c882eb
Author: MyName <my-name@my-domain.com>
Date: Sat Oct 14 17:59:09 2017 +0000
Merge branch 'master' of 14.235.21.116:/app
commit 4c882eb.. (this is copy of 601dd3a)
........
commit 601dd3a...
......
And after new pull is generated this merge commit. Can it be eliminated in the future (for new commits)?