Skip to content

Instantly share code, notes, and snippets.

@bastaramus
Forked from Dmitriy-developex/git-anonymize
Last active March 19, 2020 15:27
Show Gist options
  • Save bastaramus/953ef1623048847af65d70e6749c78b2 to your computer and use it in GitHub Desktop.
Save bastaramus/953ef1623048847af65d70e6749c78b2 to your computer and use it in GitHub Desktop.
Anonymise Git history
#!/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