I have a git repo that was converted from SVN. It lacks a .gitignore file.
Of course, I could just add one and commit it on main, but it would be better if it were present also on other branches and all the tags.
So I wonder if there is a good way to rewrite the entire history, adding a .gitignore to each and every commit?
Add the
.gitignorefile in a new commit, then perform an interactive rebase (git rebase -i --root) and place the commit as the very first. Then, rebase all other branches onto the branch (if you want to preserve any existing merge commits, use--rebase-mergeswhen doing this).N.B. this implies rewriting git's history (which will result in new commit hashes).