Native cross-platform full feature terminal-based sequence editor for git interactive rebase.

Overview

Crates.io GitHub license Coverage Status

Git Interactive Rebase Tool

Native cross-platform full feature terminal based sequence editor for interactive rebase in Git 1.7.8+.

Git Interactive Rebase Tool

This is the documentation for the development build. For the current stable release, please use the 2.1.x documentation.

Table of Contents

Features

Cross-platform

Built and works on Linux, macOS, Windows and BSD.

Set action

Easily set the action to pick, squash, fixup, edit, reword and drop.

Basic operations

Reorder rebase list

Reorder the action list with a single key press.

Reorder items

Multiline modification

Change action and reorder multiple lines at once with visual mode.

Visual mode

Toggle breaks

Toggle breaks

View commit details and diff

View the commit overview, and a full commit diff with a press of a key.

Commit overview

Commit diff

Unicode and Emoji support

Unicode support

Emoji support

Edit exec command

Easily edit the command that is run by an exec command.

exec action command edit

Edit in external editor

Need to do something in your Git editor? Quickly shell out to your editor, make a change and return to the tool.

Shell out to editor

Setup

Most systems

git config --global sequence.editor interactive-rebase-tool

Windows

Standard Command Prompt

git config --global sequence.editor "'C:/path/to/interactive-rebase-tool.exe'"

GitBash

GitBash requires the use of winpty in order to work correctly, so to set the editor use:

git config --global sequence.editor "winpty /c/path/to/interactive-rebase-tool.exe"

Notes

Windows before version 10 has serious rendering issues with saturated darker colors, such as the blue color that is entirely illegible on modern displays. While it is possible to avoid using saturated colors, a better option is to update the theme using Microsoft's ColorTool.

Temporary Override

You can temporarily use a different sequence editor by using the GIT_SEQUENCE_EDITOR environment variable:

GIT_SEQUENCE_EDITOR=emacs git rebase -i [
   
     [
    
     ]]

    
   

Usage

interactive-rebase-tool <rebase-todo-filepath>
interactive-rebase-tool --help
interactive-rebase-tool --version

Getting Help

The tool has built-in help that can be accessed by hitting the ? key.

Default Key Bindings

Key bindings can be configured, see configuration for more information.

Key Mode Description
Up All Move selection up
Down All Move selection down
Page Up All Move selection up five lines
Page Down All Move selection down five lines
Home All Move selection to start of list
End All Move selection to home of list
q Normal Abort interactive rebase
Q Normal Immediately abort interactive rebase
w Normal Write interactive rebase file
W Normal Immediately write interactive rebase file
? All Show help
c Normal Show commit information
j All Move selected commit(s) down
k All Move selected commit(s) up
b Normal Toggle break action
p All Set selected commit(s) to be picked
r All Set selected commit(s) to be reworded
e All Set selected commit(s) to be edited
s All Set selected commit(s) to be squashed
f All Set selected commit(s) to be fixed-up
d All Set selected commit(s) to be dropped
E Normal Edit the command of an exec action
v All Enter and exit visual mode
d Diff Show full commit diff
I Normal Insert a new line
Delete All Remove selected lines
Control+z All Undo the previous change
Control+y All Redo the previously undone change

Development

Install Rust

To start developing the project, you will need to install Rust, which can generally be done using rustup.

Setup

Debian and derivatives

If you plan to build a release package you will need pkg-config and liblzma-dev. They can be installed using apt:

sudo apt install pkg-config liblzma-dev

Build and run

Use cargo to build and run the project. From the project root run:

# only build
cargo build --release
# build and run
cargo run -- 
   

   

Sample rebase todo files can be found in ./test/fixtures.

Tests

Automated tests are available for all features and can be run with:

./scripts/test.bash

Linting

The project uses Clippy to provide additional linting, run with:

./scripts/lint.bash

Format

This project uses rust-fmt to provide a consistent format. A helpful script will ensure that all files are formatted correctly:

./scripts/format.bash

Release

Install Cargo Deb
cargo install cargo-deb
Building
cargo build --release
cargo deb

A deb file will be written to target/debian/interactive-rebase-tool_*.deb.

Related Projects

License

Git Interactive Rebase Tool is released under the GPLv3 license. See LICENSE.

See Third Party Licenses for licenses of the third-party libraries used by this project.

Comments
  • Ellipsis (`…`) in commit message triggers multiple display bugs

    Ellipsis (`…`) in commit message triggers multiple display bugs

    Given this commit message that contains an ellipsis:

    Use URI literals to replace deprecated `Uri.uri("…")` calls
    

    The UI of girb then:

    • shows ~@ (with a leading and a trailing space) instead of in the commit message
    • indents the commit message after the one with the ellipsis
    • indents the first empty line (consisting of, visibly, only ~) (but not those after that)

    Screenshot: girb_ellipsis-display-bug

    This was discovered using v1.1.0 and successfully reproduced with v1.2.1.

    bug fixed-in-dev 
    opened by homeworkprod 14
  • Add to package repositories

    Add to package repositories

    I would nice to have this project available everywhere! I don't have the energy (or knowledge) to provide builds for everywhere the tool could be used. If anyone is willing to create a package I would be grateful!

    List taken from ripgrep

    • [x] Debian (.deb)
    • [x] Homebrew
    • [x] FreeBSD (pkg)
    • [ ] Linuxbew
    • [ ] MacPorts
    • [x] Windows Chocolatey
    • [x] Windows Scoop
    • [x] Arch Linux (pacman)
    • [ ] Gentoo (emerge)
    • [ ] Fedora (dnf)
    • [ ] openSUSE (zypper)
    • [ ] Ubuntu (apt - PPA)
    • [ ] OpenBSD (pkg_add)
    • [ ] NetBSD (pkgin)

    If anyone is willing to help please comment below!

    opened by MitMaro 14
  • Show help if there's spare screen space

    Show help if there's spare screen space

    At least in my case, there's often a bunch of unused screen real estate, and displaying the help menu (or changing the display of the Actions: bar at the bottom) would be nice. Sort of like WordStar

    enhancement 
    opened by alok 11
  • Windows and/or git bash installation / support ?

    Windows and/or git bash installation / support ?

    I work at a Windows shop. Is Windows supported and are there installation packages? I know that ripgrep and fd have Windows executables as part of their CI builds.

    Maybe relevant: The Windows issue of rebase-editor for this: https://github.com/sjurba/rebase-editor/issues/7 Which is what I use atm with the mentioned workaround.

    enhancement help wanted windows 
    opened by jnachtigall 11
  • Show diff in PAGER

    Show diff in PAGER

    When using the d command to show a diff, I am sometimes thrown off by the lack of less keybindings. It would be convenient if we could use $PAGER instead of the built in pager to show diffs. Alternatively, adding less keybindings to the diff view would also be acceptable.

    enhancement investigate 
    opened by obsgolem 8
  • Basic implementation of #57

    Basic implementation of #57

    This should give us the basic functionality. It would be nice to eventually parse the raw git diff output so that we could get the data behind a menu. You could view the diff of each file individually.

    opened by SteveParson 8
  • Provide version information in binary

    Provide version information in binary

    Thanks for the nice tool.

    I got confused by .deb release for v0.4.0 whose filename is git-interactive-rebase-tool_0.3.0_amd64.deb (the same as for the v0.3.0).

    The binary itself does neither support the --version command-line option nor seem to tell its version somewhere else.

    So after having downloaded a file git-interactive-rebase-tool_0.3.0_amd64.deb its not clear which version it actually is, both before and after installation.

    I suggest to provide the common --version option and, if possible, correct the .deb filename of the v0.4.0 release retroactively.

    opened by homeworkprod 8
  • Incompatible with git config core.commentChar = auto

    Incompatible with git config core.commentChar = auto

    The core.commentChar git configuration has a special value, auto which automatically selects a comment character based on the content of thing being edited:

    https://git-scm.com/docs/git-config#Documentation/git-config.txt-corecommentChar

    Setting this config breaks this tool:

    hint: Waiting for your editor to close the file... Error reading file, Invalid action: #
    error: There was a problem with the editor 'interactive-rebase-tool'.
    opened by SimonSapin 7
  • Could not execute editor because of core.commentChar

    Could not execute editor because of core.commentChar

    I installed this on macos 10.13 and ubuntu 18.04 via cargo install --git (to get the latest version possible) and set this to be my sequence editor with git config --global sequence.editor interactive-rebase-tool. I get this error when I try to rebase:

    Error reading file, (...)/.git/rebase-merge/git-rebase-todo
    Reason: Invalid action: %
    Could not execute editor
    

    Changing the binary name from git-interactive-rebase-tool to interactive-rebase-tool didn't help.

    opened by alok 7
  • Getting panic error when trying to view commit full details

    Getting panic error when trying to view commit full details

    hi there! just installed this on my mac via homebrew, started a rebase, looked at a commit (c) and then tried to see the full info (d) and got a crash:

    thread 'main' panicked at 'byte index 21 is not a char boundary; it is inside...
    

    version info:

    • git version 2.35.1
    • interactive-rebase-tool 2.2.0 (2022-05-01)
    Screen Shot 2022-10-12 at 1 49 56 PM

    it seems specific to the one commit i was looking at, others seem to work ok!

    unfortunately the repo is not open source, but if there's any help i can do get a stack trace or something i'm happy to. seems like a handy tool so i'm hoping i can use it.

    bug 
    opened by schpet 6
  • Release Version 2.2.0

    Release Version 2.2.0

    The last release was last April, but a lot of changes have been made to the project since then; perhaps at least a new patch release should be published to account for that.

    Release checklist:

    • [x] Update the release* workflows to include latest versions of Ubuntu, Debian (https://github.com/MitMaro/git-interactive-rebase-tool/pull/649)
    • [x] Fix documentation errors (https://github.com/MitMaro/git-interactive-rebase-tool/pull/650)
    • [x] Add supported platforms to the README (https://github.com/MitMaro/git-interactive-rebase-tool/pull/658) (https://github.com/MitMaro/git-interactive-rebase-tool/pull/661)
    • [x] Test on Windows
    • [x] Test on macOS
    • [x] Test on Linux
    • [x] Update CHANGELOG (https://github.com/MitMaro/git-interactive-rebase-tool/pull/653)
    • [x] Bump Cargo.toml version number (https://github.com/MitMaro/git-interactive-rebase-tool/pull/662)
    • [x] Update README to remove reference to development build (https://github.com/MitMaro/git-interactive-rebase-tool/pull/662)
    • [x] Release crates to crates.io
    • [x] Tag new release tag

    Found issues:

    • [x] Resize event flood causes render lag, needs a debounce (https://github.com/MitMaro/git-interactive-rebase-tool/pull/652)
    • [x] Shift + ? not working on Windows (https://github.com/MitMaro/git-interactive-rebase-tool/pull/655)
    • [x] ? key does not work during edit (https://github.com/MitMaro/git-interactive-rebase-tool/pull/656)
    • [x] Home/end missing from diff help (https://github.com/MitMaro/git-interactive-rebase-tool/pull/657)
    • [x] External editor not receiving all inputs (https://github.com/MitMaro/git-interactive-rebase-tool/pull/660)
    opened by clarfonthey 6
  • Add arm64 and armhf builds to release

    Add arm64 and armhf builds to release

    Can you provide precompiled binaries for armhf and arm64? Those platforms are increasingly popular with Raspberry PIs, Apple M1 (you can run virtualised linux), etc.

    Looking at the build scripts it seems that you could use qemu-binfmt support and arm64/debian:... docker images to compile for another arch on a existing runners.

    If someone wants to compile binary via docker:

    docker run -v "$PWD/arm64:/cargo" -it --rm arm64v8/rust:bullseye cargo install --root /cargo git-interactive-rebase-tool
    docker run -v "$PWD/armhf:/cargo" -it --rm arm32v7/rust:bullseye cargo install --root /cargo git-interactive-rebase-tool
    

    Or, just generic way for a current architecture:

    docker run -v "$PWD/cargo:/cargo" -it --rm rust:bullseye cargo install --root /cargo git-interactive-rebase-tool
    

    Take into account that this will take quite some time on RPI.

    enhancement 
    opened by ayufan 1
  • git rebase --edit-todo should not empty the file

    git rebase --edit-todo should not empty the file

    I used git rebase --edit-todo to look at how many commits were left in my rebase, but when i didnt change the file, interactive-rebase-tool cleared the file to abort, and then the rebasing ended, and I had to continue the rebase with a cherry-pick of the remaining commits.

    enhancement 
    opened by forivall 6
  • Feature Request: Custom actions on keybinds

    Feature Request: Custom actions on keybinds

    It'd be nice to be able to bind custom keywords to binds The idea is to use it with git-revise, which adds index and cut as available actions

    I've hardcoded support for those in https://github.com/dali99/git-interactive-rebase-tool but it'd be better if there was a Custom(String) action or something you could manually bind

    Architecturally this seems a little complicated though

    enhancement investigate 
    opened by dali99 3
  • Doesn't work with xargs anymore

    Doesn't work with xargs anymore

    Hey,

    I'm using your tool for a couple of years now. It's great and helps me a lot in my work. Thanks!

    Recently I have noticed that one of my rebase commands has stopped working:

    echo $COMMIT_HASH | xargs -o git rebase --interactive
    

    After I run it, the terminal window starts to constantly rerender (multiple times per second) and didn't react to key presses at all. So I have to kill it. I tested it both in the default Terminal.app and iTerm2. I'm using macOS 11.3.1.

    Not sure if it's directly related to xargs or something else. Let me know if you need me to provide more info or check something else.

    bug macOS blocked 
    opened by maltsev 2
  • Linting for possible merge conflicts

    Linting for possible merge conflicts

    Maybe git-interactive-rebase-tool can show errors in case there would be merge errors, even before the user has exited and saved the editor to continue the rebase.

    See example in da-x/depree: Vim ALE checker for Git rebase interactive. Initially I wrote this tool for commit dependency detection, but then I fitted it to perform rebase script linting in my editor.

    It is written in Rust and also uses libgit2. It's quite fast, does the conflict checking in memory and it does not affect Git state at all. so should be easy to integrate in. Maybe I can turn depree into a library for git-interactive-rebase-tool to use.

    enhancement blocked 
    opened by da-x 3
Releases(latest)
Owner
Tim Oram
Software Developer, founding member of the Computer Technology Society Newfoundland and Labrador, B.Sc. Computer Science.
Tim Oram
Git Explorer: cross-platform git workflow improvement tool inspired by Magit

Gex Git workflow improvement CLI tool inspired by Magit. This project is still under initial development, but I am actively dogfooding it and features

Peter Hebden 204 Jan 6, 2023
Simple macros to write colored and formatted text to a terminal. Based on `termcolor`, thus also cross-platform.

Bunt: simple macro-based terminal colors and styles bunt offers macros to easily print colored and formatted text to a terminal. It is just a convenie

Lukas Kalbertodt 202 Dec 22, 2022
A Rust CLI tool that helps you enforce Git policies through Git hooks both server and client side

GitPolicyEnforcer This is a command line utility written in Rust, that helps you utilize Git hooks, to enforce various policies. It currently supports

Vagelis Prokopiou 4 Aug 14, 2022
git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers.⛰️

git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers. The changelog template can be customized with a configuration file to match the desired format.

Orhun Parmaksız 5k Jan 9, 2023
A git sub-command to view your git repository in the web browser

git-view A git sub-command to view your git repository in the web browser! About Are you also frustrated from moving your hands away from the keyboard

Hamothy 5 Sep 26, 2022
A performant terminal-based project editor with extensive shortcuts

omega A performant and extensive terminal-based project editor with a wide variety of modern shortcuts. How to use omega [path] This section will guid

Nils Wrenger 3 Mar 31, 2024
Parallel iteration of FASTA/FASTQ files, for when sequence order doesn't matter but speed does

Rust-parallelfastx A truly parallel parser for FASTA/FASTQ files. Principle The input file is memory-mapped then virtually split into N chunks. Each c

Rayan Chikhi 8 Oct 24, 2022
VEP-like tool for sequence ontology and HGVS annotation of VCF files

Mehari Mehari is a software package for annotating VCF files with variant effect/consequence. The program uses hgvs-rs for projecting genomic variants

Berlin Institute of Health 5 Mar 31, 2023
Simple Interactive Terminal Todo App in Rust

todo-rs Simple Interactive Terminal Todo App in Rust Quick Start $ cargo run TODO Controls Keys Description k, j Move cursor up and down Shift+K, Shif

Tsoding 56 Dec 8, 2022
A simple interactive OSC (Open Sound Control) debugger for terminal

oscd, a simple interactive OSC debugger for the terminal by using nom as a lexer/parser, oscd offers auto type casting and support sending multiple osc arguments.

Karnpapon Boonput 5 Oct 19, 2022
A library that creates a terminal-like window with feature-packed drawing of text and easy input handling. MIRROR.

BearLibTerminal provides a pseudoterminal window with a grid of character cells and a simple yet powerful API for flexible textual output and uncompli

Tommy Ettinger 43 Oct 31, 2022
🖥 A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3

?? A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3

Christian Visintin 574 Jan 5, 2023
Cross-platform Rust library for coloring and formatting terminal output

Coloring terminal output Documentation term-painter is a cross-platform (i.e. also non-ANSI terminals) Rust library for coloring and formatting termin

Lukas Kalbertodt 75 Jul 28, 2022
Cross platform terminal library rust

Cross-platform Terminal Manipulation Library Crossterm is a pure-rust, terminal manipulation library that makes it possible to write cross-platform te

crossterm-rs 2.1k Jan 2, 2023
Alacritty - A fast, cross-platform, OpenGL terminal emulator

Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows.

Alacritty 43.8k Dec 31, 2022
Cross-platform terminal screen clearing library

ClearScreen Cross-platform terminal screen clearing library. API documentation. Dual-licensed with Apache 2.0 and MIT. Uses Caretaker Maintainership.

null 23 Dec 30, 2022
Cross-platform terminal program to download IEEE journals

IEEE Journal Downloader A cross-platform terminal program which tries to download every article in a specified journal and merge the documents into on

Fong Chien Yoong 18 Jul 23, 2022
glicol cli: cross-platform music live coding in terminal

glicol-cli What's this? It's a command line interface that you can use for music live coding with Glicol. It watches a file changes and then update th

Glicol 70 Apr 14, 2023