On 30 July 2013 13:50, Felipe Contreras <felipe.contre...@gmail.com> wrote:
> On Mon, Jul 29, 2013 at 8:42 PM, Hilco Wijbenga
> <hilco.wijbe...@gmail.com> wrote:
>> Hi all,
>> I have a (public) "feature" branch that has been kept up-to-date with
>> "master" by regularly merging master back into it. I would now like to
>> get all the changes from feature but not any of the commits.
>> Basically, I want to replay all of feature's commits without creating
>> those commits.
>> I thought something like
>> git cherry-pick -n abcd^..feature
>> should do the trick (while on master, where abcd is the SHA-1 of the
>> commit where feature was created) but I get conflicts.
>> First, why the conflicts? I have done all the merges so cherry-pick
>> should simply be able to replay them? Second, what is the correct way
>> of doing this?
> % git cherry-pick -n --no-merges --right-only --topo-order
> --cherry-pick abcd^..feature
> Felipe Contreras
Wouldn't git merge --squash do what you're looking for? It seems like
the only way to not get conflicts trying to cherry pick is if you
never had any conflicts while you were merging master into your
feature branch. "Evil" merges, where you actually have to change code,
even if it's just to resolve conflicts, don't tend to replay
It seems like this should do it:
% git checkout master
Switched to branch 'master'
% git merge --squash feature
Squash commit -- not updating HEAD
Automatic merge went well; stopped before committing as requested
% git commit
git merge --squash will just apply the changes without creating a
commit. You can then make any final changes you want to and write your
commit message for the feature.
Hope this helps,
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html