Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Surely, if your commits are both worth keeping and constitute your work towards a public release, then they should form part of your published history? If you don't want to publish your full repository history then you may be better off just using <code>git archive</code> to create release tarballs.</p> <p>Having said that if you really want to create a release branch with a separate history then it is possible. You are setting yourself up for more maintenance overhead, though, as you can never merge from your private history to your public release branch as that would bring in all the private history to your release branch. This is what git does; it tracks where changes come from.</p> <p>You can merge from the release branch to the private branch but as your work is (presumably) coming from the private branch this won't gain you much. Your easiest option is to have a separate release branch which contains only snapshot commits of the state of the private branch at release points.</p> <p>Assuming that you have reached a point where you want to create a commit on the release branch (<code>release</code>) based on the current commit in the private branch (<code>private</code>) and assuming that you have the tree to be released checked out with no changes to the index, here is what you can do.</p> <pre><code># Low-level plumbing command to switch branches without checking anything out # (Note: it doesn't matter if this branch hasn't yet been created.) git symbolic-ref HEAD refs/heads/release # Create a new commit based on the current index in the release branch git commit -m "Public release commit" # Switch back to the private branch git checkout private </code></pre> <p>You can do this for each release (or sub-release) and the new commit will be built directly on top of the previous release without incorporating any of your private history.</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