Rewrite the merge commit to the squash addition commit

I merged a long-lived branch, and it took me a while to complete the merge due to conflict resolution.

I found out that I cannot publish my work with git-svn : git svn rebase will reassemble all the merged branch commits instead of sending a single commit. I discovered git merge --squash bit too late ...

Is it possible to change (rebase interractive?) The merge fixation in the squash merge commit without losing the work already done to resolve conflicts (that is, without starting a new merge, since I did not rerere tool)

+7
git merge git-svn squash
source share
2 answers

Maybe git rebase --preserve-merges works for you.

Here is a detailed answer about what happens when this happens:

What exactly does git "rebase -preserve-merges" do (and why?)

I apologize that I do not like copying and pasting from there.

+7
source share

I had a similar problem and I was able to create a concise commit by simply discarding and confirming the changes.

Initial layout:

 * 06074985 (HEAD -> test1) Merge branch 'test2' into test1 |\ | * eb2aa088 (test2) test2 commit * | c83180c8 test1 commit |/ * b6628265 (master) base commit 

Git Commands: git branch temp (so I don't lose the merge commit) git reset HEAD ~ 1 git add. git commit -m "Squash commit" git diff temp (just to make sure nothing has changed)

Final layout:

 * 5e229615 (HEAD -> test1) squash commit | * 06074985 (temp) Merge branch 'test2' into test1 | |\ |/ / | * eb2aa088 (test2) test2 commit * | c83180c8 test1 commit |/ * b6628265 (master) base commit 
0
source share