By default, using the git merge (not rebase) operation in IntelliJ will immediately create a merge-commit. Sometimes you may want to selectively revert changes or alter content before concluding the merge.
Using either the "Git" menu or version control status area in the bottom right of the project window, checkout the destination branch of the merge:
Use the "Git -> Merge" menu to bring up the following window. There's many options in this window, which simplify the command-line equivalents. In any scenario, first choose the source branch from the dropdown:
Remove any options you already have:
and add the --no-commit
option:
Click the "Merge" button to proceed.
The "Commit" tool window will show the merge changes, but not yet selected/staged for commit:
At this point you can edit files as normal, selectively revert lines from the diffs...
...or rollback/revert entire files:
Select/stage the changes from the "Commit" tool window and proceed with the merge's commit as you normally would.
Looking at the "Git" tool window's "Log" tab, the merge-commit appears as it should:
Top comments (0)