We have the following history
start master public
| | |
v v v
o---o-- ... --o---o---o
Unfortunately we made some commits into the master
branch containing some sensitive data. We amended this in a separate branch called public. Now we want to "cut-off" the public
branch in order get a complete and clean "state" in public
but without the compromising history parts still contained via master
. In other words we want the following new history:
start master
| |
v v
o---o-- ... --o---o
\
o <- public
Now checking out public
shall lead to the same working tree as in the original situation but without the sensible history details. Afterwards we mothball the old master
branch: Rename it to unsafe
and elaborate a new master
branch out of the new public
branch. This way we conserve the old history in unsafe
and are able to push the public
branch into the public without any worries:
start unsafe
| |
v v
o---o-- ... --o---o
\
o---o-- ... --o <-- public
\ /
o-- .. --o-- ... --o <-- master
What are the right git commands to achieve this?
PS: Of course we could checkout start
, make a new branch and commit there the entire working tree of the public
branch. But there must be a different, fancier, git way!