如何在 IDEA 中将本地提交组与单次推送组合起来?

在 IDEA 中,我试图推动一些提交。

我有一个需求,在远程服务器上,它看起来像单一的行动。

我点击推动,看到下面的窗口 enter image description here

我以为会在这里看到壁球复选框,但没有看到。

请帮帮我。

92766 次浏览

You can do it using rebase. Go to VCS/Git/Rebase. Then select Interactive option. It will show you a list of commits, where you can pick which ones you want to squash.

After you hit Start rebasing it will prompt you for a commit message for the squashed commit. After that is done you can push your squashed commit using push dialog.

Squash dialog

More information about rebase in IntelliJ is here.

For me, the simplest way with IntelliJ is:

  • Go to Log tab and choose the commit from which you want to squash
  • Right click and select Reset Branch to this commit
  • Choose the Soft Or Mixin options to keep your changes from the commit
  • Commit your changes and don't forget to check the Amend commit option

There is a new way:

Version Control -> Log -> Right click on the commit -> Interactively rebase from here and then you can choose to pick/squash the rest of commits.

With the latest version of IntelliJ you can simply select all the commits, right-click -> Squash commits