Merge theme thread on git by deleting the whole history of thread thread commit?

I would like to know if the following is possible in git:

Suppose I have the following story:

A---B---C---D---E master \ W---X---Y topic 

I would like to merge all the changes made to the topic branch back to the wizard, but without saving 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 story:

 A---B---C---D---E---F master 

Where F is the new commit in the main branch, which is equivalent to the changes made in commits W , X , Y , it is applied all at once.

I would also like to maintain the integrity of the topic:

 A---B---C---D---E---F master \ W---X---Y topic 

Is it possible? I did some tests with git rebase, but so far it has not behaved as I need.

Thanks in advance.

+4
source share
3 answers

This should be simpler than the bad zeppelin was suggested, but I have not tried this:

 $ git checkout master $ git merge --squash topic $ git commit *what has changed* 

However, when I understand git help merge correctly, it should do the trick.

+7
source

Create a copy of the topic branch, interactively reinstall it on the main branch ( git rebase -i E ), crushing the commits in the topic branch into one and, finally, delete a copy of the created topic branch. After that, you should be able to get what you want.

+1
source

Create a new branch from the topic (this is dropping)

git reinstall wizard - inactive

(crush commit in one)

Then on the host, cherrypick will commit one on the discarded branch.

As a result, you will get exactly what you want on the main thing, and the topic thread will be intact.

There may be simpler ways to do the same ...

0
source

All Articles