I have a repository with around 3000 commits where i want to squash around 250 of them in the middle of history between two dates like this:
a--b--c--d--e--f--g--h--i--j--k--l--m--n
a--b--c--d'-------------------k--l--m--n
I already know the dates and shas of d and j. What is the best practice to do this?
You can also try a different approach which is kind of similar to the merge approach.
Note: Assuming
n
to be the latest anda
be the oldest commit.Create a new branch with commit
k
as head.Then, soft reset the head to the parent of commit
d
.Commit the changes, as all the changes from commit
d
tok
are not present in the staging area. (git status
to verify)Merge the commits post
k
,