Note that there are some explanatory texts on larger screens.

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

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload