I would like to know if the following is possible in git:
Suppose I have the following history:
A---B---C---D---E master
\
W---X---Y topic
I would like to merge all the changes made in the topic branch back to master, but without retaining the commit history. That is, instead of:
A---B---C---D---E---F master
\ /
W---X---Y topic
I would like to have the following history:
A---B---C---D---E---F master
Where F
is a new commit in the master branch that is equivalent to the changes made in commits W
, X
, Y
, applied all at once.
I would also like to be able to keep the topic branch intact:
A---B---C---D---E---F master
\
W---X---Y topic
Is this possible? I've been making some tests with git rebase, but so far it hasn't behaved on the way I need.
Thanks in advance.
It should be simpler than what bad zeppelin suggested, but I haven't tried this:
$ git checkout master
$ git merge --squash topic
$ git commit *what has changed*
However, when I understand git help merge
right, it should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With