Repository navigation
feat: interactive rebase from a commit's menu: reorder, squash, fix up or drop the commits after it - #23
Merged
Conversation
…p or drop the commits after it
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Right-click a commit in the graph and pick Interactive rebase onto this commit… to put together an interactive rebase in the centre. It lists the commits the rebase takes along, newest first like the graph, and for each you can move it up or down and pick, squash, fix up or drop it. Squash and fixup meld a commit into the one below it (squash keeps both messages, fixup that of the one below); a dropped commit is struck through. Start rebase runs it; it stays disabled, with the reason on hover, while the oldest commit it keeps would have nothing to meld into. Cancel or Escape goes back to the graph.
It runs your own
git rebase -i, with the list written over git's own, so hooks, signing and config work as on the command line. The list is the onegit rebase -iwould show: commits without a copy in the target, leaving out merges. When the commits change outside GitCraft while the list is open, it starts again from what is there now, so a rebase never leaves out a commit it did not show. A rebase that stops at a conflict shows the existing bar (continue, skip, abort), and undo takes back the whole rebase.Roadmap: "Interactive rebase", part 1. Rewording and dragging in the graph come next.
How it is tested
Core test against a real repository: the list for a commit, for a branch with a cherry-picked copy (left out) and for
HEAD(empty); a rebase in a new order with squash, fixup and drop gives the expected messages and files; undo takes it back to where it started.App tests through the accessibility tree: reorder, squash and drop three commits and start (Start disabled while the oldest kept commit is a squash, also after the one below it is dropped); and a list that starts again when a commit is added outside, so that commit is not dropped, plus the message when there is nothing to rebase.
Tried in the app: moved a
fixup!commit next to its commit, fixed it up and dropped another (result checked withgit logand the files), undid the rebase, and a rebase that stopped at a conflict, then aborted.cargo fmt --all,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacepassIt adds as little code as the change needs, and removes what it makes unnecessary
Nothing in it comes from GitKraken or another closed-source client (see CONTRIBUTING.md)