3

I've worked on a git repository for a while and choose to share it with other people. I've used my personal email address for the commits and I'm trying to set it to another one, before I make the repository public. I've read some threads like SO 750172 and it works with git log, but I'm still able to find my old email with grep in .git/logs/HEAD and .git/logs/refs/heads/master.

Is there a way to remove it from there, too, without losing my history?

There is only one copy of the repository yet, if that makes a difference.

1 Answer 1

4

The reflogs would contain pointers to old versions of your commits from before you rewrote history to change your email address, this is why the old email address is still visible in those. Those references are local to your repository, and neither those refs nor the commits they point to would be pushed to a remote repository. So you've already cleaned up the history that would be made public.

If you're really sure that you won't need to go back and you want to clean up the reflogs as well you can run:

git reflog expire --expire=now --all

But this would be removing a feature that is there for safety and is in no way necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.