Suppose I have a giant repo for an as-of-yet unpublished software product called "Hammerstein", written by the famous German software company "Apfel" of which I am an employee.
One day, "Apfel" spins out the Hammerstein division and sells it to the even more famous company "Oráculo" which renames "Hammerstein" to "Reineta" as a matter of national pride and decides to open source it.
Agreements mandate that all references to "Hammerstein" and "Apfel" be replaced by "Oráculo" and "Reineta" in the repository.
All filenames, all commit messages, everything must be replaced.
So, for example:
src/core/ApfelCore/main.cpp
must becomesrc/core/OraculoCore/main.cpp
.The commit message that says
"Add support for Apfel Groupware Server"
must become"Add support for Oraculo Groupware Server"
The strings
ApfelServerInstance* local_apfel
,#define REINETA
andUrl("http://apfel.de")
must becomeOraculoServerInstance* local_oraculo
,#define HAMMERSTEIN
, etc.
This applies to files that are not in HEAD
anymore as well.
What is the simplest and most pain-free method to achieve it with minimal manual intervention (so that it can be applied in batch to a potentially large number of repositories/assets)?
- BFG can replace the strings, but it seems to only have a
--delete-file
option, not a--rename-file
, and even then it does not take patterns as an argument - This approach seems to work only for
HEAD
and not for the whole history; I have had no luck using it with--tree-filter