Clean history : remove delete actions and ignore some files
Say I’ve got project A with this history :
- HEAD : Hotfix
- HEAD~1 : Changelog
- HEAD~1 : Dev
- HEAD~2 : Feature
- HEAD~3 : Typo
And I started project B on top of that history, getting to this :
- HEAD : Changelog
- HEAD~1 : Clean repo
- HEAD~2 : Delete unnecessary files
- HEAD~3 : Hotfix (project A)
- HEAD~4 : Changelog (project A)
- HEAD~5 : Dev (project A)
- HEAD~6 : Feature (project A)
- HEAD~7 : Typo (project A)
Now I’ve got a clean project B and I’d like to start my next apps with a fork of this one.
Problem is the bold commit : it deletes files. I would like to rewrite the history to omit that action, preventing merges from the base repo to project A to delete my files altogether.
Ideally, the deleted files should never appear in project B’s history.
This might be a duplicate question of “Delete commits from a branch in Git”, “Completely remove file from all Git repository commit history” or “GIT How to clean history pack for old deleted files?” but it might not as the problem exposed is pretty specific.
Please share you experience with the community!