i’m trying to remove the earliest commit from my Git repository’s history using git-filter-repo.
Current Git log:
- 57e88c7 (HEAD -> oo, master) Merge pull request #5 from RianMan/test
……
- ae01e9c vue init
I want to remove the earliest commit (ae01e9c) while keeping all other commits intact
I’ve tried using git-filter-repo with various approaches, including –commit-callback and –parent-filter, but none of them have worked.”
this my script :
def remove_earliest_commit(commit, parents):
earliest_commit = b'ae01e9c'
if commit.startswith(earliest_commit):
return [] # Remove this commit by returning an empty list of parents
elif not parents:
return [] # This is now the earliest commit, so it should have no parents
else:
return parents # Keep other commits unchanged
man rian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.