We have the following story
start master public
| | |
v v v
o
Unfortunately, we have committed some commits to a branch mastercontaining some sensitive data. We changed this in a separate branch called public. Now we want to “disconnect” the branch publicto get a complete and clean “state” in public, but without the compromising parts of the story still contained through master. In other words, we need the following new story:
start master
| |
v v
o
\
o <- public
Now the check publicwill lead to the same working tree as in the initial situation, but without detailed history information. Subsequently, we will cancel the old branch master: rename it to unsafeand develop a new branch masterfrom the new branch public. Thus, we keep the old story in unsafeand can insert the branch publicinto the public without any worries:
start unsafe
| |
v v
o
\
o
\ /
o
What are the proper git commands to achieve this?
PS: Of course, we can check start, create a new branch and fix the whole tree of the branch work there public. But there must be a different, more convenient, git way!
source
share