Skip to content

JetBrains/more-interactive-rebase

Repository files navigation

⚠️ VERY IMPORTANT: This is an educational project. (Severe) bugs can be expected, and may not be fixed quickly. Please use with caution.

A More Interactive Rebase

Coverage Badge Pipeline Status


A More Interactive Rebase for JetBrains is a plugin for the integrated development environments (IDEs) from JetBrains. The tool makes it easier for you to perform Git Interactive Rebase actions, without the need for a command line, by providing a clear graphical visualization of the commit history and the changes you want to perform on it.

⚠️ DISCLAIMER: This plugin is still under very early stages of development, consider this to be an access to the pre-alpha version of the plugin. It may be possible that certain functionalities do not work as intended or do not work at all. Your feedback would prove very useful for us. Thanks!

πŸ“‹ Table of Contents

  1. ✨ Features
  2. βš™ Installation
  3. ⚑ Quick Start
  4. πŸ”— Dependencies
  5. 🀝 Contributing
  6. ❓ Support
  7. πŸ—Ί Roadmap
  8. βœ’ Authors and Acknowledgement

view.png

✨ Features

A More Interactive Rebase offers the following functionality for a better user experience:

  • Opens in the editor tab for a better visualization
  • Shows clearly the commit history in the form of a graph
  • Gives details about the commits and their file changes
  • Allows performing interactive rebase actions on selected commits
  • Allows reordering of commits by drag-and-drop
  • Displays two branches with their relation visually
  • Allows changing the base of a branch on top of another branch
  • Shows the difference between the changed graph and the initial state
  • Allows for cherry-picking a commit
  • Shows the progress of the rebase and the commit on which it has stopped due to conflicts

βš™ Installation

You can easily get started with setting up the plugin by following these guidelines:

Guidelines for Setting up

  1. Download the Plugin zip on your device
  2. Extract the files in it in a folder
  3. Open a JetBrains IDE and navigate to Settings/Preferences > Plugins > βš™οΈ > Install plugin from disk...
  4. Navigate to the folder of the Plugin and select interactive-rebase-jetbrains-version.jar
  5. The Plugin should be in the list of Plugins and you can search for it by name A More Interactive Rebase
  6. Click on the Plugin and enable it
  7. Restart your IDE

⚑ Quick Start

Opening the Plugin

Navigate to Tools > Interactive Rebase Current Branch. The Plugin opens as a file in the editor tab. The branch drawn shows the latest commits on the checked out branch. Closing the Plugin and opening it again keeps the changes that were made.

entry.png

Commit Information

Clicking on one or multiple commits selects them. The commit information and file changes of the selected commits are presented on the right side of the screen. Double-clicking on a file change opens its diff and shows the changes.

commit

Interactive Rebase Actions

After selecting the commits, the buttons that are active show the available Interactive Rebase actions. It is important to note that any changes made on the graph are not actually executed until the Start Rebasing button is pressed. The idea of the graph is to show a preview of how the commit history will look in the end. All actions can be taken in various ways including the action toolbar, a context menu opened on a right click and keyboard shortcuts If you are not very familiar with the Interactive Rebase actions that Git has to offer, you can read the Rewriting History Chapter provided by Git for more information.

  • Drop - After selecting commits, pressing the Drop button will remove the selected commits from the commit history. The action can also be performed by selecting one or multiple commits and pressing Backspace / Delete or by opening the context menu and selecting the action.

drop

  • Fixup - If there is only one selected commit, pressing the Fixup button will perform fixup of that commit with the previous one (older in the commit history). In the case where multiple commits are selected, they are fixed up into the oldest selected commit. This action combines automatically the commit messages of the selected commits. The action can also be performed by selecting one or multiple commits and pressing Option / Alt + F or by opening the context menu and selecting the action.

fixup

  • Pick - Selecting the commits and pressing Pick reverts all changes done on them except for reordering. The action can also be performed by selecting one or multiple commits and pressing Option / Alt + P or by opening the context menu and selecting the action.

pick

  • Reorder - You can drag and drop the commits along the branch if you want to reorder them. The action can also be performed by selecting one or multiple commits and pressing Option / Alt + β­‘ to move the commit upward or Option / Alt + β­£ to move the commit downward.

reorder

  • Reword - If a single commit is selected you can click the Reword button that opens a text field in place of the commit message. Alternatively, if there is no selected commit, you can just double-click on a commit message, which will also enable the text field. The action can also be performed by selecting one commit and pressing Option / Alt + R or by opening the context menu and selecting the action.You can edit the message and press Enter or click anywhere outside of the text field. If you want to cancel your rewording, pressing Escape closes the text field.

reword

  • Squash - If there is only one selected commit pressing the Squash button will squash that commit with the previous one (older in the commit history). In the case where multiple commits are selected, they get squashed into the oldest selected commit. After squashing, a text field opens for you to reword the commit message for the squashed commit. The action can also be performed by selecting one or multiple commits and pressing Option / Alt + S or by opening the context menu and selecting the action.

reword

  • Stop to Edit - After selecting commits and pressing the Stop to Edit button the IDE opens each commit in chronological order (from oldest to newest) and allows you to make changes to that commit (amend it). After having made your changes, you have to stage them by typing git add .. Pressing Continue on the pop-up in the lower right corner of the screen will proceed with the rebasing of the next commit. You can also press Abort to stop the stop-to-edit action. While rebasing is happening, it is possible to visualize which commits have already been rebased and on which commit we are stopping to edit, this can be seen by the progress on our tool that colors commits that have already been rebased. The action can also be performed by selecting one or multiple commits and pressing Option / Alt + E or by opening the context menu and selecting the action.

stop to edit

Additional Actions

  • Add Branch - Pressing the Add Branch button opens the branch selection panel. This panel contains all the names of all local branches of the repository. The action can also be performed by selecting pressing Option / Alt + A. A branch can be selected by pressing it or by navigating to it making use of the β­‘ and β­£ arrow keys and pressing Enter, once a branch is selected, it will also be displayed in the main panel of the plugin. To deselect it press the - button or press Escape when in focus.

add branch

  • See Difference - Pressing the See Difference button opens a popup that displays the original state of the branch and the state of the branch with all the actions taken. It provides a better understanding of the actions to perform. The action can also be performed by selecting pressing Cmd / Ctrl + D.

comparison

  • Undo - Pressing the Undo button will revert the last action taken on the tool regardless of the commit it was taken on. The action can also be performed by selecting pressing Cmd / Ctrl + Z.
  • Redo - Pressing the Undo button will reapply the most recently undone action on the tool. The action can
    also be performed by selecting pressing Cmd / Ctrl + Shift + Z.

undo and redo

  • Collapsing - Pressing the Collapse will automatically hide commits such that the whole branch can fit on the screen without scrolling if no commits are selected. In the case that commits are selected, only these commits will become hidden. To expand the hidden commit, simply press on the three dots representing the collapsed commits. The action can also be performed by pressing Cmd / Ctrl + C.

collapse

  • Rebasing - After selecting a commit in the added branch, pressing the Rebase Onto button will rebase the checked out branch on top of the selected commit of the added branch. If no commit is selected, the checked out branch will rebase on the head of the added branch. The action can also be performed by dragging the label containing the name of the checked out branch pressing over the label of the added branch. It can also be accessed by pressing Alt / Option + Shift + R or by opening the context menu.

rebase

  • Cherry Pick - After selecting a commit in the added branch and pressing the Cherry Pick button, the selected commit will be added as the new head of the checked out branch. It is also possible to drag and drop a commit from the added branch to any position of the checked out branch. The action can also be performed by pressing Option/Alt + C

cherry pick

  • Reset - Pressing the Reset button reverts the graph to its initial state, before any changes were indicated. The action can also be performed by pressing Cmd / Ctrl + R.

reset

  • Start Interactive Rebase - Pressing the Rebase button starts the Interactive Rebase and executes all the changes that were made starting from the lowest changed commit on the graph. The action can also be performed by pressing Option / Alt + Enter.

  • Keyboard Navigation - Using the arrow keys allows for keyboard navigation. When no commit is selected, β­‘ will select the bottommost commit and β­£ will select the topmost commit. Holding down Shift while pressing the arrow keys will make it so that multiple commits are selected. Pressing β­  will give focus to the branch selection panel if the checked out branch is selected. In the case that the added branch is selected, it will select the checked out branch. Pressing β­’ will in turn select the checked out branch if the branch selection panel is focused and it will select the added branch if the checked out branch is selected. Pressing Escape will deselect all selected commits.

Keyboard Shortcuts

  • Selecting a commit - Use arrow keys ↑ and ↓ to move up and down on a branch. Press ← and β†’ to move between branches. Use Shift for range selection.

  • Selecting multiple commits - Press Shift + Click for range selection and Command/Ctrl + Click for non-contiguous selection.

  • Deselecting commits - Escape

  • Select branch - Enter (Branch Selection Panel)

  • Deselect branch - Escape (Branch Selection Panel)

  • Drop - Backspace/Delete

  • Fixup - Option/Alt + F

  • Pick - Option/Alt + P

  • Reorder - Option/Alt + ↑ / ↓

  • Reword - Option/Alt + R

  • Squash - Option/Alt + S

  • Stop to Edit - Option/Alt + E

  • Add branch - Option/Alt + A

  • See Difference - Cmd/Ctrl + D

  • Undo - Cmd/Ctrl + Z

  • Redo - Cmd/Ctrl + Shift + Z

  • Collapse - Cmd/Ctrl + C

  • Rebase Onto - Option/Alt + Shift + R

  • Cherry Pick - Option/Alt + C

  • Reset - Ctrl + R

  • Start Interactive Rebase - Option/Alt + Enter

πŸ”— Dependencies

IntelliJ OpenAPI

In order for our Plugin to interact with the current JetBrains IDEs we are making use of the Intellij Platform API. This streamlines the process of building a Plugin by offering extension points to already existing functionality. It is the framework on which JetBrains' IDEs are based and provides a Virtual File System as a Component. The UI of this product is built using the UI framework of IntelliJ Platform, specifically custom classes that extend the Swing functionality. Thus, incorporating the signature design of the IDE. Furthermore, IntelliJ Platform provides additional run configurations within the Gradle project which provide a number of actions such as: simulating an IDE with our plugin for manual testing, creating a JAR file from which the plugin can be executed and immediately publishing into JetBrains Marketplace, etc.

git4idea

To allow interaction with Git functionality, we use the git4idea Plugin as a library. It provides methods for calling Git commands such as Git Rebase, Git Log, Git reset, etc. In order to establish the connection the folder git4ideaClasses in this project contains some of the git4Idea classes with the respective copy right.

IntelliJ Community

Our Plugin is compatible with IntelliJ Community 2024.1 and newer versions.

Gradle

For managing the dependencies during runtime and testing we use Gradle 8.7. It is included and recommended in the already available documentation provided on IntelliJ Plugin Platform SDK. We have defined tasks for tools such as Jacoco and Spotless.

Kotlin

The plugin was developed in Kotlin, used with Java SDK 17 to ensure backwards compatibility.

Swing

The UI of the plugin was developed with Swing.

Unit Testing

The product is unit tested with the frameworks JUnit 4 and Mockito, and the library AssertJ. All test classes are extending the BasePlatformTestCase class of the IntelliJ test Framework. This provided access to test fixtures like a test project, which was essential for instantiating all units responsible for executing the business logic.

Integration Testing

For system/integration testing the plugin uses VCS Platform Test in order to set up all the git actions. To effectively generate Git resources, we made use of two utility classes: GitExecutor and GitTestUtil.

We relied on the Awaitility library. We used it to pause test execution until specific slow operations fulfill a certain assertion.

🀝 Contributing

If you want to contribute to our project please refer to the Contributing Guide.

❓ Support

For any questions and difficulties, please refer to our Support guide.

πŸ—Ί Roadmap

Since the project is still under development, here you can see the plan for the foreseeable future. You can see the whole Roadmap via this link. Keep in mind that opening it requires access to the repository.

![roadmap.png](Images/Roadmap 27.04.2024.png)

βœ’ Authors and Acknowledgment

Main contributors to the project are the members of our team:

  • Marina MΔƒdΔƒraş
  • Diego Becerra Merodio
  • Aleksandra Savova
  • Ada Turgut
  • Galya Vergieva

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages