Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
git filter-repo and amend commit date editing
// last commit
export GIT_COMMITTER_DATE="$(date -R --date="13 days ago")"; git commit --amend --date="$GIT_COMMITTER_DATE"
// selected dates
git filter-repo -f --commit-callback '
from datetime import datetime  46.175.47.49   96%  ─╯
d = commit.author_date.split()
date = datetime.fromtimestamp(int(d[0]))
if date.day == 2:
d[0]=str(int(d[0])+12*60*60).encode("ascii")
commit.author_date = commit.committer_date = b" ".join(d)
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment