Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I rewrite the history of a published git branch in multiple steps?
    primarykey
    data
    text
    <p>I've got a git repository with two branches, <code>master</code> and <code>amazing_new_feature</code>. The latter branch contains the work on, well, an amazing new feature. A colleague and me are both working on the same repository, and the two of us commit to both branches.</p> <p>Now the work on the amazing new feature finished, and a bit more than 100 commits were accumulated in the <code>amazing_new_feature</code> branch. I'd like to clean those commits up a bit (using <code>git rebase -i</code>) before merging the work into master.</p> <p>The issue we're facing is that it's quite a pain to rewrite/reorder all 100 commits in one go. Instead, what I'd like to do is:</p> <ol> <li>Rewrite/merge/reorder the first few commits in the <code>amazing_new_feature</code> branch and put the result into a dedicated branch which contains the 'cleaned up' history (say, a <code>amazing_new_feature_ready_for_merge</code> branch).</li> <li>Rebase the remaining <code>amazing_new_feature</code> branch on the <code>amazing_new_feature_ready_for_merge</code> branch.</li> <li>Repeat at 1.</li> </ol> <p>My idea is that at some point, all the work from <code>amazing_new_feature</code> should be in <code>amazing_new_feature_ready_for_merge</code> and then I can merge the latter into <code>master</code>.</p> <p>Is this a sensible approach, or are there better/easier/more fool-proff solutions to this problem? I'm especially scared about the second step of the above algorithm since it means rebasing a published branch. IIRC it's a dangerous thing to do.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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