3

I am trying to change the author info in a Git repository uploaded on Github. I went to the Github page and they show a guide to change the author in the commits. I have the following code

git filter-branch --env-filter '
OLD_EMAIL="Admin@user"
CORRECT_NAME="hernan232"
CORRECT_EMAIL="hdvanegasm@unal.edu.co"
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

When I run the code, it works, but when I execute

git push --force --tags origin 'refs/heads/*'

It shows "Everything up-to-date". And I go to the Github repository and anything changes. Can you help me with this?

ckruczek
  • 2,361
  • 2
  • 20
  • 23
Lemark
  • 139
  • 3
  • 11
  • Define what you mean by "it works". The filter-branch command will succeed even if (or in fact, *especially* if) it winds up doing nothing in the end, and in that case, there would be nothing new to push. – torek May 29 '17 at 02:34

2 Answers2

0

To check if the command has indeed worked, using the log pretty format (as in this answer), type:

 git log --pretty=format:"%h%x09%an%x09%ae%x09~ %an%x09%ce"

That will display the author and committer name and email for each commit: if they are correct, then you can push.
If they are unchanged, there would be nothing to push.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

I might be wrong, but I think the last command is just pushing the tags. To push all the branches (including master), you need to run git push --force --all first.

I tested on a personal repo and I got the same message as you (and I didn't have any tags created yet -- maybe this is why it's "up to date"). Running the command above I managed to push.

cleison
  • 1,425
  • 1
  • 13
  • 14