-
-
Save bastaramus/953ef1623048847af65d70e6749c78b2 to your computer and use it in GitHub Desktop.
Anonymise Git history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Suppose you want to do blind reviewing of code (eg for job interview | |
# purposes). Unfortunately, the candidates' names and email addresses are | |
# stored on every commit! You probably want to assess each candidate's version | |
# control practices, so just `rm -rf .git` throws away too much information. | |
# Here's what you can do instead. | |
#At first clone a repo with --bare option. | |
# Rewrite all commits to hide the author's name and email | |
git filter-branch -f --env-filter ' | |
export GIT_AUTHOR_NAME="Anonymous Developer" | |
export GIT_AUTHOR_EMAIL="[email protected]" | |
export GIT_COMMITTER_NAME="Anonymous Developer" | |
export GIT_COMMITTER_EMAIL="[email protected]"' --tag-name-filter cat -- --branches --tags | |
# Delete remotes, which might point to the old commits | |
for r in `git remote`; do git remote rm $r; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment