GitHub将许多提交合并成一个 [英] GitHub Merge many commits into one

查看:333
本文介绍了GitHub将许多提交合并成一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查了很多,但没有找到类似的问题。



假设我有两个分支。分支S(稳定)和分支E(实验)。实验已从稳定的分支创建。



我一直在E分支上工作,执行

  git add -A。 
git commit -mmy new commit
git push origin E

它工作得很好。当我认为是时候了,我只是在做:

  git checkout S 
git merge E
git push origin S

而且这个工作正常,但是我的稳定分支被每一次提交来自实验分支。我不想在实验分支中挤压所有提交,但我希望在合并期间只有一个提交,而不是所有提交。



可能在那里是一个非常简单的命令,但我没有找到它。不幸的是,git rebase E并没有这样做,所有提交仍然显示为单一提交。



感谢您的支持。
<解决方案 git merge --squash E 而不是 git merge E c $ c>。


I've searched a lot but didn't find a similar question.

Let's say that I have two branches. Branch S (stable) and branch E (experimental). Experimental has been created "from" Stable branch.

I'm working all the time on E branch by executing

git add -A .
git commit -m "my new commit"
git push origin E

And it works just fine. When I think it's time for that I'm simply doing:

git checkout S
git merge E
git push origin S

And that works fine as well but my stable branch is spammed with every single commit from experimental branch. I don't want to "squash" all commits into one in experimental branch but I want to have only one commit during such merge instead of all single ones.

Probably there is a very simple command for doing that but I didn't find it. Unfortunately git rebase E doesn't do the trick, all commits are still showed as single ones.

Thank you for your time.

解决方案

Try git merge --squash E instead of git merge E.

这篇关于GitHub将许多提交合并成一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆