Coder Social home page Coder Social logo

naokiri / git-interactive-rebase-tool Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mitmaro/git-interactive-rebase-tool

0.0 1.0 0.0 3.85 MB

Native cross platform full feature terminal based sequence editor for git interactive rebase. Written in Rust using ncurses. This is a fork to send PR. See MitMaro/git-interactive-rebase-tool for mainline.

Home Page: https://gitrebasetool.mitmaro.ca/

License: GNU General Public License v3.0

Rust 96.82% Roff 0.64% PowerShell 0.40% Shell 2.15%

git-interactive-rebase-tool's Introduction

Crates.io Build Status Build status GitHub license

Git Interactive Rebase Tool

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

Git Interactive Rebase Tool

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

Install

Configure

Most systems

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

Windows

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

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
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

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 [<upstream> [<branch>]]

Configuration

The tool can be configured using the git config command. Invalid values are ignored and the default used instead. String values are case-insensitive.

Example

git config --global interactive-rebase-tool.foregroundColor black

Options

Key Default Type Description
autoSelectNext false bool If true, auto select the next line after action modification
breakColor white Color Color used for the break action
diffAddColor green Color Color used for lines and files added in a diff
diffChangeColor yellow Color Color used for lines and files changed in a diff
diffRemoveColor red Color Color used for lines and files removed in a diff
dropColor red Color Color used for the drop action
editColor blue Color Color used for the edit action
fixupColor magenta Color Color used for the fixup action
foregroundColor white Color Color used for most text and the UI
selectedBackgroundColor 35,35,40 Color Color used as the background color for the selected line
indicatorColor cyan Color Color used for text the indicates or needs to standout
inputAbort q String Key for abort rebase with prompt
inputActionBreak b String Key for setting action to rebase
inputActionDrop d String Key for setting action to drop
inputActionEdit e String Key for setting action to edit
inputActionFixup f String Key for setting action to fixup
inputActionPick p String Key for setting action to pick
inputActionReword r String Key for setting action to reword
inputActionSquash s String Key for setting action to squash
inputConfirmNo n String Key for rejecting a confirmation
inputConfirmYes y String Key for confirming a confirmation
inputEdit E String Key for entering edit mode
inputForceAbort Q String Key for forcing an abort of the rebase
inputForceRebase W String Key for forcing a rebase
inputHelp ? String Key for showing the help
inputMoveDownStep PageDown String Key for moving the cursor down by a large step
inputMoveDown Down String Key for moving the cursor down
inputMoveLeft Left String Key for moving the cursor left
inputMoveRight Right String Key for moving the cursor right
inputMoveSelectionDown j String Key for moving the selected line(s) down
inputMoveSelectionUp k String Key for moving the selected line(s) up
inputMoveUp Up String Key for moving the cursor up
inputMoveUpStep PageUp String Key for moving the cursor up by a large step
inputOpenInExternalEditor ! String Key for opening the external editor
inputRebase w String Key for rebasing with confirmation
inputShowCommit c String Key for showing the selected commit
inputToggleVisualMode v String Key for toggling visual mode
pickColor green Color Color used for the pick action
rewordColor yellow Color Color used for the reword action
squashColor cyan Color Color used for the squash action
verticalSpacingCharacter ~ String Vertical spacing character. Can be set to an empty string.

Special Keys

Key Description
PageDown Page Down key
Down Down arrow key
Left Left arrow key
Right Right arrow key
Up Up arrow key
PageUp Page Up key

Valid Color Values

The valid colors are the eight original 8 ANSI colors. They are black, blue, cyan, green, magenta, red, white and yellow. Each terminal controls the exact color for these color names. On terminals that support 256 colors, a color triplet with the format <red>,<green>,<blue> can be used. Each color has a range of 0 to 255 with 255, 255, 255 resulting in white and 0,0,0 resulting in black. A value of -1 or transparent can be used to use the default terminal color.

Configuring External Editor

The external editor action will first attempt to start the editor defined by the Git configuration "core.editor", followed by the VISUAL and EDITOR environment variables. Finally, if neither is set the external editor defaults to using vi.

The % character in the value will be replaced with the git rebase todo file. If the % character is not found, then the git rebase todo file will be provided as the last argument.

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

You will need build-essential and libncurses5-dev to build the project. Additionally, you will need pkg-config and liblzma-dev if you wish to build a release. They can be installed using apt-get:

sudo apt-get install build-essential libncursesw5-dev
sudo apt-get 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 <path-to-git-rebase-todo-file>

Format

Use rust-fmt format project. You need to run format with nightly. The current nightly rust version is nightly-2019-09-13. You can find the current nightly rust version in the scripts/format.bash.

# format code before you commit
cargo +nightly-2019-09-13 fmt

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.

TODO

  • Full support for exec action
  • Insert action
  • Configure key bindings

Related Projects

License

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

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

git-interactive-rebase-tool's People

Contributors

alok avatar danielpower avatar dziman avatar ecumene avatar gudahtt avatar hi-rustin avatar jackharrhy avatar jnachtigall avatar leojmaro avatar mitmaro avatar nickolay avatar pvalkone avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.