Skip to content

Instantly share code, notes, and snippets.

@nerzid
Created October 30, 2024 00:40
Show Gist options
  • Save nerzid/3394aa20df753c02ed6d8661b9014b98 to your computer and use it in GitHub Desktop.
Save nerzid/3394aa20df753c02ed6d8661b9014b98 to your computer and use it in GitHub Desktop.
python git_filter_repo.py --commit-callback "
if commit.author_name == b'full name of the previous author':
commit.author_name = b'username of the new author'
commit.author_email = b'email of the new author'
if commit.committer_name == b'full name of the previous author':
commit.committer_name = b'username of the new author'
commit.committer_email = b'email of the new author'
"
@nerzid
Copy link
Author

nerzid commented Oct 30, 2024

In my case, the previous author was just my full name so it wasn't connected to any account, and therefore didn't have to change an e-mail for that.

@nerzid
Copy link
Author

nerzid commented Oct 30, 2024

have the git_filter_repo.py in the same folder of this command, and run this command in a terminal that supports multi-line string copy-paste like MobaXterm. Then run the following command to push the changes to the repo.

git push -u origin master --force

in my case, I moved my previous repo from gitlab to here, so the main branch was called main.

git push -u origin main --force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment