How to change author, committer, and date of some commit?
Find a hash of your commit (e.g. HASH_OF_COMMIT_TO_CHANGE
)
Run this command with the date you want this commit to happen on, and new names and emails:
git -c user.name="NEW NAME" -c user.email="new_email@gmail.com" commit --amend --date="Tue Nov 20 03:00 2018 +0100" --author="NEW NAME <new_email@gmail.com>"
This will return you a newly created commit hash: HASH_OF_NEW_COMMIT
.
git replace HASH_OF_COMMIT_TO_CHANGE HASH_OF_NEW_COMMIT
git filter-branch -- --all
git replace -d HASH_OF_COMMIT_TO_CHANGE
git push --force-with-lease origin master
Written by lakesare
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#