Skip to content

Instantly share code, notes, and snippets.

@JuniorJPDJ
Last active April 15, 2020 02:43
Show Gist options
  • Save JuniorJPDJ/77c8a6bad05e6e0205c5edee03ce978c to your computer and use it in GitHub Desktop.
Save JuniorJPDJ/77c8a6bad05e6e0205c5edee03ce978c to your computer and use it in GitHub Desktop.
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