I have a repository hosted on GitHub in which I want to replace my LICENSE
file with another LICENSE
file in the git history. The original LICENSE
file was added with the very first commit of the repository.
The repo has open PRs by me and a teammate altough there is not much active development happening right now.
How do I replace the LICENSE
file in my git repository history safely?
I read that there might be issues when rewriting history with other branches as they depend on refs that are not existing anymore when force-pushing changed history to upstream.
Optimally I want all upstream branches to still "work" i.e. I should be able to merge them with a correct diff after rewriting history.
I probably do not have to pay attention to local branches of other co-workers that are not pushed upstream. It would be nice to also not break them but it's not that important really.
I saw that instead of git filter-branch
git filter-repo
should be used nowadays. As long as it works safely any solution is okay for me altough I would interested in the "best practice" solution as well ;)