workwise
workwise

Reputation: 1103

Git: remove user information from repository

I have a repository with multiple users committing to it.

I want to make a copy of the repository, with all user information removed. That is, individual commits/comments history should be present, but information on who did what should be removed (or say, replaced by one particular new user).

How to achieve this? Ideally, I also want to synchronize the two repositories. I know how to do this using --mirror, but do not know how to set things up with all "user information" in mirrored repository removed (or replaced by a single new user).

Upvotes: 2

Views: 1109

Answers (1)

nitishagar
nitishagar

Reputation: 9413

You can try the following: (this will change all commits to have the same (new) author)

git filter-branch -f --env-filter "GIT_AUTHOR_NAME='Newname'; GIT_AUTHOR_EMAIL='newemail'; GIT_COMMITTER_NAME='Newname'; GIT_COMMITTER_EMAIL='newemail';" HEAD

You can read more about options - here.

Upvotes: 5

Related Questions