不提交以前的提交,我只想添加一个提交,它接受在我合并的另一个分支上所做的所有其他更改?

Not to commit previous commits, I want just to add a commit that takes all the other changes made on the other branch I merged?

我想获取更改但不想发布我在测试分支上所做的所有提交...我想要的是在合并之后,进行这些更改并在主服务器上提交(一次),而不是发布所有这些提交。

谢谢

我还没有尝试过任何东西,因为我想确定该怎么做。那我再推一下。

git merge test
git status

您的分支领先 'origin/master' 6 次提交

您可以压缩您的提交,但我倾向于更喜欢重新提交的简单性。我 post 感兴趣的人可以在这里找到解决方案 :

git checkout test
git reset --soft origin/master
git commit -m "message for this whole feature"
git push origin HEAD

然后 test-branch 将被推送到远程,并且您的合并请求 test > master 将仅包含上面所做的一次提交。

git merge test --squash
git commit -m "foo bar"

对于 --squash,更改被合并而提交没有。