Squash and Merge - Github

Answered

I want to do a squash and merge of the feature branch to master on github.

I saw somewhere there was a reference to squash but I wasn't sure this was the same thing as it seemed related to interactive rebase????

Can it be done in WebStorm?

TIA

Rob

 

6 comments
Comment actions Permalink

Squash is just one of the options of Interactive rebase, so yes, it is related.

Currently, to squash commits in IntelliJ, you need to start Interactive rebase (e.g. using the Rebase Interactively from Here action from the Log), and select what commits you want to squash.

There is a request to allow squashing by selecting commits in the Log directly - see https://youtrack.jetbrains.com/issue/IDEA-85434

Since 2018.3, there is also another option - autosquash https://youtrack.jetbrains.com/issue/IDEA-195690 which allows you to fixup selected commit with your local changes.

1
Comment actions Permalink

In github I can do this in one step just by clicking a button.....

I found in webstorm under the git menu 'Merge' which has a dialog which allows me to select a branch I want to merge and at the bottom there is a checkbox 'squash commit'.

That sounds like it does a 'squash and merge' similar to github but I am not sure as from what you say I need to start and interactive rebase??

I really want to just take all the change from the feature branch and merge them as one commit in master

Any thoughts
Rob

1
Comment actions Permalink

Thanks for the clarification.

> take all the change from the feature branch and merge them as one commit in master

Then the squash option on the Merge dialog is what you need, it will call git merge --squash

1
Comment actions Permalink

Hi Dmitriy,

I have been using the Squash merge in WebStorm and Idea for a while, and it used to leave the commit "open" meaning it would not create a commit, it would leave the merged files available for me to change and selectively commit.
This option seems to be gone as of the 2019 release.
i.e. it creates a commit with all the changes.
Is there a way I can get back the old "feature"?
I don't want to commit everything in one commit after I have squashed everything in.

Thanks,
Dave

0

Please sign in to leave a comment.