Is there a way to replay commits from a source branch into a destination branch but taking into consideration changes made in .gitignore in the destination branch?
Here is the scenario:
Say I branch out of master and start committing files, including .bin files that should've been in .gitignore but weren't. Is there any way I can go to master, commit "*.bin" to .gitignore and then fix my topic branch when rebasing it (or some other automatic operation)? By fixing I mean remove the changesets of any .bin file, which are now ignored. This means 1) if a commit has a change on a.txt and foo.bin it should commit only a.txt and 2) if a commit only has a change on foo.bin it should be dropped altogether
The goal is to easily cleanup multiple mistakes only caught at Pull Request time.
Regular git rebase didn't work. the mistakenly committed file remains committed even if in the (new) linear history of the repo, the gitignore pattern was there before the bad commit