← 返回首页
python-scripts/scripts/17_rewrite_git_history.md at master · realpython/python-scripts · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Latest commit

 

History

History
executable file
·
13 lines (10 loc) · 443 Bytes
 master
Top

File metadata and controls

  • Preview
  • Code
  • Blame
executable file
·
13 lines (10 loc) · 443 Bytes

I always forget how to back date, so here we go ...

This is dangerous and should be signed off by the omniscience, omnipotence Git him/herself. Rewriting history is evil, in other words.

$ git add <file_name> $ export GIT_COMMITER_DATE="Sun Jun 15 14:00 2014 +0100" $ export GIT_AUTHOR_DATE="Sun Jun 15 14:00 2014 +0100" $ git commit -m "so bad" $ git push

GIT_COMMITER_DATE and GIT_AUTHOR_DATE are environment variables

Footer

© 2026 GitHub, Inc.