Intellij - 如何挤压本地分支 [英] Intellij - How to squash local branch only

查看:620
本文介绍了Intellij - 如何挤压本地分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在Intellij中使用Git时,我如何压缩所有提交给本地分支的提交?我在rebase分支窗口中使用了什么设置?



我已经尝试将Onto设置为local / master和From到我的分支,但是它会尝试将每次提交的主要更改合并到我的分支中,即使我通常每天早上将我的分支重新分配给主服务器......所以应该没有冲突。但它几乎总是发现冲突并导致合并问题。我只想压缩分支提交和消息,所以当我推送到Github时,它只能看到一个。



解决方案

这可能有点不舒服,但是您可以使用HEAD〜
的git符号,所以在Onto 'd写入你想包含
的提交的数量:

在这个例子中,我有4个(最后4个)提交我想合并成1 。







在开始对话框中列出了条目订单,所以你需要
在第一个下拉框后挤压。 (我做了第一个
a reword,但这不是必须的,因为无论如何都会有一个消息更改对话框
,所以它可以留在'选择'上)







然后只是一个新的消息提交联合提交,你就完成了。




When using Git inside of Intellij, how do I squash all of my commits for a local branch? What settings do I use in the rebase branch window?

I've tried setting the Onto to local/master and From to my branch, but then it goes and tries to merge master changes into my branch for each commit I did, even tho I typically rebase my branch onto master every morning...so there SHOULD be no conflicts. Yet it almost always finds conflicts and causes merge issues. I ONLY want to squash the branch commits and messages so when I push to Github it only sees one.

解决方案

It might be a little uncomfortable but you can use the git notation of HEAD~ so in the "Onto" field you'd write the amount of commits you want to include like:

In this example I have 4 (the last 4) commits I want to combine into 1.



In the opening dialog the entries are listed in order, so you need to squash all after the first one with the drop box. (I made the first a reword but that's not needed as there will be a message-change dialog for the squashing anyway, so it can be left on 'pick')



then just a new message for the combined commits and you're done.

这篇关于Intellij - 如何挤压本地分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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