Re: Need some help with git rebase
From: Wincent Colaiuta <hidden>
Date: 2016-06-15 22:47:57
El 31/12/2009, a las 00:02, Sylvain Rabot escribió:
In fact I want to backport the commits of the feature branch into 12.72.1. I used git rebase because the drawings of the man page looked like that I wanted to do and it does except for the part it resets the head of my feature branch. But as you said the good behavior would be to cherry pick each commit of the feature branch and apply them into 12.72.1, right ?
Well rebasing is just a convenient way of cherry-picking a bunch of commits, so it's probably the right tool for the job. But as you've seen, it has the effect of "moving" or "transplanting" the feature branch (replacing the old feature HEAD). If you really want the original feature branch HEAD to continue existing after the rebase you'll need to take some specific action to preserve it beforehand (creating a temporary branch before doing the rebase like Peter Baumann suggested) or restore it afterwards (using "git branch" like I suggested). But before you actually do that, I'd make sure that you actually have a valid reason for keeping that branch around. Maybe wanting to "backport" those commits onto various different branches might be a valid reason. But it's worth thinking through because Git gives you various tools for supporting different workflows (merging, rebasing, cherry-picking) and they each have their use cases. Cheers, Wincent