I've got a git repository with two branches, master
and amazing_new_feature
. 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.
Now the work on the amazing new feature finished, and a bit more than 100 commits were accumulated in the amazing_new_feature
branch. I'd like to clean those commits up a bit (using git rebase -i
) before merging the work into master.
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:
- Rewrite/merge/reorder the first few commits in the
amazing_new_feature
branch and put the result into a dedicated branch which contains the 'cleaned up' history (say, aamazing_new_feature_ready_for_merge
branch). - Rebase the remaining
amazing_new_feature
branch on theamazing_new_feature_ready_for_merge
branch. - Repeat at 1.
My idea is that at some point, all the work from amazing_new_feature
should be in amazing_new_feature_ready_for_merge
and then I can merge the latter into master
.
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.