Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@PlugFox

This comment has been minimized.

Copy link

@PlugFox PlugFox commented Aug 8, 2020

Thanks you very much)

@rogerBridge

This comment has been minimized.

Copy link

@rogerBridge rogerBridge commented Sep 6, 2020

Thank you bro : )

@IvanSimeonov

This comment has been minimized.

Copy link

@IvanSimeonov IvanSimeonov commented Dec 5, 2020

Thank you!

@ucalyptus

This comment has been minimized.

Copy link

@ucalyptus ucalyptus commented Dec 18, 2020

@bgromov , Newname is our github id or actual name?

@benitezandres

This comment has been minimized.

Copy link

@benitezandres benitezandres commented Jan 8, 2021

Thanks!

@sebastian13

This comment has been minimized.

Copy link

@sebastian13 sebastian13 commented Feb 15, 2021

Nice! This even keeps old timestamps!
To push to a remote afterwards, a --force is needed.

git push --force --tags origin 'refs/heads/main'
# or
git push --force

Credits to the comments of https://stackoverflow.com/a/750191/8940679

@artiscode

This comment has been minimized.

Copy link

@artiscode artiscode commented Mar 28, 2021

Thank you so much! This really helps when you change from a personal handle to a business one.

@Yaroslavzev

This comment has been minimized.

Copy link

@Yaroslavzev Yaroslavzev commented Apr 20, 2021

Thank you so much!

@aitechcompany

This comment has been minimized.

Copy link

@aitechcompany aitechcompany commented Jul 20, 2021

Thank you

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