I'm trying to delete/squash a bunch of old commits that I don't want on my git history which were just made to put together code from multiple locations that were not using git (local folders from other programmers)
This is how the actual git history looks:
What I want is to keep from A to N (newest) and either delete everything else or squash it into A.
I've tried two things
git rebase -i --root -xtheirs
and then mark from the root to 'A' to squash, but it ended changing some parts of code, which from what i've understood while researching is because of the old merge commits trying to re-do the merge commits.
I've also tried to use the param --rebase-merges but ended with wrong code too.
The other thing that I tried is to just do
git rebase -i --root
and delete everything between 'A' and root. But it also deleted all the code that were introduced in those commits.
As you might have guessed I'm pretty new to this kind of git commands so any explanation would be appreciated.
Other approaches are also welcome!
Edit: As @TTT noted in the comments, this is a duplicate of How to remove all but last n commits from git history to save space, which has a good answer.