I would like to create a git script which replaces author "A" with author "B" in a specified commit range (abcd..dcba). How can I do that? Here is what I have so far:
#!/bin/sh
#
# git-myCommand
#
#
git filter-branch --commit-filter '
if [ git rev-list --boundary 02e60c8..dc4c65f ]; then
if [ "$GIT_AUTHOR_NAME" = "A" ];then
GIT_AUTHOR_NAME="B";
fi;
fi;
git commit-tree "$@"'
problem is that git says
Rewrite $SHA1-Number git commit-tree: line 48: [: too many arguments
Is the git rev-list --boundary command even legal in an if statement? if i remove the if [git rev-list ... ] statement it'll work.
Ideal would be if I can add input variables. So the command would look like
git myCommand $AuthorExpression $AuthorReplace $CommitA..$CommitB
Edit: Some thinks that this question has already been asked. for those please read the problem above again and compare it wit the previously asked questions. AFAIK THIS question (test if commits are between commit A and commit B) has not been asked yet. If i'm wrong, sorry for wasting your time. Thanks to those who have tried to answer that question!