Git Explorer: cross-platform git workflow improvement tool inspired by Magit

Related tags

Command-line git rust cli
Overview

Gex

crates.io download license stargazers

Gex

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

Aims

Primarily, this is a personal project since I recently switched to Neovim from Emacs and miss the simplicity and efficiency of using Magit. However, I do have some general aims, which are subject to change:

  • Simple - uncluttered UI.
  • Intuitive - it should be easy to learn to use gex.
  • Cross platform - primary focus on Linux, but should work well on Windows and MacOS.
  • Configurable - certain preferences in gex should be configurable to suit your own workflow.
  • Comprehensive* - you should be able to use gex to do everything you can do in git.

* gex supports executing arbitrary git commands with : for when something is not yet available

Installation

Gex is hosted on crates.io. You can either install from source, or you can use cargo:

NOTE: You will need Rust on your system for this installation method.

$ cargo install gex

Usage

To enter gex, simply type gex in console.

$ gex

Navigation

Key Action
j / Down Move down
k / Up Move up
Tab Expand item

Git actions

Key Action
s stage item
S stage all items
u unstage item
U unstage all items
F pull from remote
: execute git command

Gex actions

Key Action
c commit menu
b enter branch mode
r refresh
q quit gex

Branch mode

Key Action
b checkout new branch
Space / Enter checkout branch
Esc exit branch mode

License

This project is dual-licensed under either:

at your option.

Contributing

If you want to contribute to gex, thank you so much! If you find a bug or want a new feature, please open an issue or submit a PR! I am happy to review and merge PRs.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Comments
  • gex command fails when LANG=ja_JP.UTF-8 (maybe other non-english locales as well)

    gex command fails when LANG=ja_JP.UTF-8 (maybe other non-english locales as well)

    Hi, I usually launch emacs only for magit, so I am interested in gex

    gex command fails when the locale is non-English:

    $ gex --version
    gex 0.3.2
    
    $ echo $LANG
    ja_JP.UTF-8
    
    $ gex
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Error { input: "ブランチ master", code: Tag })', /home/<username>/.cargo/registry/src/github.com-1ecc6299db9ec823/gex-0.3.2/src/status.rs:307:34
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    $ LANG=en_US gex
    # it works
    

    It may be because git status's result changes depending on locale:

    $ LANG=en_US git status
    On branch master
    Your branch is up to date with 'origin/master'.
    
    nothing to commit, working tree clean
    
    $ echo $LANG
    ja_JP.UTF-8
    
    $ git status
    ブランチ master
    Your branch is up to date with 'origin/master'.
    
    nothing to commit, working tree clean
    

    (ブランチ means "branch" in japanese)

    and gex uses git status at https://github.com/Piturnah/gex/blob/v0.3.2/src/status.rs#L299-L307

    bug 
    opened by oshikiri 4
  • Panic in `src/status.rs:307:34` when there are no changes in the repo

    Panic in `src/status.rs:307:34` when there are no changes in the repo

    Message:

    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Error { input: "Sur la branche nu-ansi-term", code: Tag })', /Users/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/gex-0.3.2/src/status.rs:307:34
    

    With RUST_BACKTRACE=1:

    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Error { input: "Sur la branche nu-ansi-term", code: Tag })', /Users/alexis/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/gex-0.3.2/src/status.rs:307:34
    stack backtrace:
       0: rust_begin_unwind
                 at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
       1: core::panicking::panic_fmt
                 at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
       2: core::result::unwrap_failed
                 at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/result.rs:1805:5
       3: gex::status::Status::fetch
       4: gex::status::Status::new
       5: gex::main
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    

    Meta

    • gex --version:gex 0.3.2`
    • OS: macOS 12.5.1
    opened by poliorcetics 3
  • Fix markdowns

    Fix markdowns

    Found via this command:

    markdownlint *.md --disable MD013 MD033 MD024
    

    See a detailed description of the rules is available at https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md

    opened by kianmeng 3
  • Addition of `#![warn(clippy::nursery, clippy::pedantic)]`.

    Addition of `#![warn(clippy::nursery, clippy::pedantic)]`.

    Hello!

    Adding the following snippet to the top of main.rs will introduce a bunch of best practices and such that can improve code quality. See here for more details.

    #![warn(clippy::nursery, clippy::pedantic)]
    

    This is the allow list that I have, also as a suggestion.

    Happy holidays!

    opened by Xithrius 2
  • Doesn't know its in git repo in child directories

    Doesn't know its in git repo in child directories

    If I'm in a child directory of a git repo it should recognize that I am in a git repo.

    Since you are already using the git command you could use git rev-parse --is-inside-work-tree to detect a git repo instead of looking for the git folder

    bug 
    opened by praveenperera 2
  • Try gitoxide instead of git2

    Try gitoxide instead of git2

    as a user of magit, i am glad people are spreading the magic of that UI

    There is an awesome project under active development that promises much faster git interactions https://github.com/Byron/gitoxide

    that has already delivered 2x performance improvements on large repos like the linux kernel https://github.com/o2sh/onefetch/pull/635

    gitoxide has a group of issues to replace git2 https://github.com/Byron/gitoxide/issues?q=is%3Aissue+is%3Aopen+label%3AC-replace-git2

    I appreciate this is a personal project and git2 works fine for you now. Only wanted to make you aware in case you might find this interesting

    opened by petr-tik 1
  • Console not cleared for

    Console not cleared for "Commit Options" menu

    When opening the commit menu, the underlying content is not cleared. This can be seen in the following screenshots:

    image

    After pressing c the text "es:" leaks through from behind:

    image

    bug good first issue 
    opened by Piturnah 0
  • No previous commit information for initial commit

    No previous commit information for initial commit

    git log HEAD^..HEAD --pretty=format:"%h %s" -n 1 fails with

    fatal: ambiguous argument 'HEAD^..HEAD': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    
    bug 
    opened by Piturnah 0
  • returning an Err instead of using panic!()

    returning an Err instead of using panic!()

    I'm a beginner in rust and this is my first contribution in a rust project. Please correct me if I'm wrong.

    Issue: https://github.com/Piturnah/gex/issues/17

    opened by caycun 0
  • Replace missed panics with early returns

    Replace missed panics with early returns

    The following lines really shouldn't be panics, they were missed when anyhow crate was added in 9f13bccbe0df16e9debd837ce9e28e470a39b2b3.

    https://github.com/Piturnah/gex/blob/60d0f5a397e745e16dd00903a233c61e3c9fb184/src/status.rs#L356

    https://github.com/Piturnah/gex/blob/60d0f5a397e745e16dd00903a233c61e3c9fb184/src/status.rs#L381

    Fix: return from the function with Err

    good first issue 
    opened by Piturnah 0
  • Avoid aborting execution where possible

    Avoid aborting execution where possible

    There are lots of places in the code where we are aborting on an error even though the error is recoverable. Now that the minibuffer API is a lot simpler, it seems like a good idea to change some of these aborts into warnings.

    For example: https://github.com/Piturnah/gex/commit/5b55cfe5a7cd0e630547d1846c2697edbc7a4411#diff-2b963e7f31870073ce48ea6dd279de519d083f2e92d4a33124809465fd7569e5L43-R49

    Here we were originally exiting the program on the error but switched to reporting it within gex. There are many similar cases where this is possible.

    Could potentially be good if we could just print the anyhow error, something like

    foo
        .context("failed to foo")
        .map_err(|e| {
            mini_buffer.push(format!("{e}"), MessageType::Error);
        });
    
    enhancement 
    opened by Piturnah 0
  • Changes to working tree not shown for non-English locales

    Changes to working tree not shown for non-English locales

    In general Gex may run into issues when the locale is not English as it often directly parses the output from git.

    In particular changes to the working tree are not shown as we are looking for the lines "Untracked files:" and "Changes not staged for commit:" https://github.com/Piturnah/gex/blob/71d455f16f1786374ca2da7fa94a411ff2055121/src/status.rs#L317 https://github.com/Piturnah/gex/blob/71d455f16f1786374ca2da7fa94a411ff2055121/src/status.rs#L349

    This is a pretty hacky solution and I would rather directly interface with libgit2.

    I don't have the time to work on this right now so I am marking as "help wanted" and in the next release I will include a warning if the locale is not English. As stated in the README Gex is primarily a personal project, but that being said I do very much want to support non-English locales.

    TODO:

    • [x] Implement warning when locale is non-English
    • [ ] Actually fix the issue

    Originally discovered in #7

    bug help wanted 
    opened by Piturnah 0
  • Use external diff tool

    Use external diff tool

    So far I'm really enjoying using gex, coming from tig -> gitui, I realized that gex allows me to do most of what I really used those tools for in a much smaller package.

    One suggestion I have to improve gex is to allow the usage of an external diff tool to view changes. there are other light weight diff tools that I think would compliment the gex, like difftastic. What do you think?

    enhancement 
    opened by jssee 1
Releases(v0.3.6)
  • v0.3.6(Dec 28, 2022)

  • v0.3.5(Dec 21, 2022)

    Changelog

    Fixed

    • Stdout propagation from command execution causing top of display to go off-screen
    • Crashing on jumping to top/bottom of diffs when there are no diffs
    • Not refreshing after executing a command with :
    • Error reporting for failed hunk patch

    Full Changelog: https://github.com/Piturnah/gex/blob/master/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v0.3.4(Dec 7, 2022)

    Changelog

    Added

    • Warning when opening Gex with locale other than English (#13)
    • New navigation controls
      • g / K to jump to first element of list
      • G / J to jump to last element of list
    • Colour coding of --help flag output

    Changed

    • Minibuffer now maintains a stack of messages so messages are not lost if more than one is sent per frame
    • Display an error instead of panicking on invalid UTF8 from a git process

    Removed

    • Colouring of + and - in stdout propagation

    Fixed

    • Sometimes showing empty messages in minibuffer, for example after creating a commit

    New Contributors

    • @Br1ght0ne made their first contribution in https://github.com/Piturnah/gex/pull/12

    Full Changelog: https://github.com/Piturnah/gex/blob/master/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v0.3.3(Aug 30, 2022)

    Changelog

    Changed

    • Errors are reported properly instead of panicking

    Full Changelog: https://github.com/Piturnah/gex/blob/master/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v0.3.2(Aug 21, 2022)

    Changelog

    Fixed

    • Showing first heading in bold before initial commit
    • Not showing previous commit information on initial commit (#6)
    • Displaying diff of new files with an extra space at beginning of all lines other than first

    Full Changelog: https://github.com/Piturnah/gex/blob/master/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Aug 19, 2022)

  • v0.3.0(Aug 19, 2022)

    Changelog

    Added

    • Most recent commit hash and title displayed in status
    • : to execute arbitrary git command
    • Two new commit commands
      • extend - add additional changes to previous commit
      • amend - fix commit message
    • UI to display available commit commands
    • Colouring of + and - in stdout propagation
    • --help or -h flag for help information

    Changed

    • Use c c to create a commit
    • -v flag changed to -V
    • User is notified of unrecognised command line arguments and gex exits instead of quietly ignoring
    • Status says "Unstaged changes" and "Staged changes" instead of "files"
    • Propagate all of stdout instead of only first line

    Fixed

    • Showing empty stdout or stderr in the case that the exit code didn't match
    • gex not recognising git repositories from within subdirectories (#2)

    Full Changelog: https://github.com/Piturnah/gex/blob/master/CHANGELOG.md

    New Contributors

    • @Yevgnen made their first contribution in https://github.com/Piturnah/gex/pull/3
    • @kianmeng made their first contribution in https://github.com/Piturnah/gex/pull/4
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(Aug 15, 2022)

    Changelog

    Added

    • --version or -v flag to display gex version
    • Notice if there are no existing branches in branch list
    • Propagation of errors and stdout from git subprocesses
    • F to pull remote changes

    Fixed

    • gex freezing on viewing branch list before initial commit

    Full changelog: https://github.com/Piturnah/gex/blob/master/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Aug 12, 2022)

    Changelog

    Fixed

    • gex crashing on untracked files in some cases
    • gex not displaying "working tree clean" message

    Full Changelog: https://github.com/Piturnah/gex/blob/master/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Aug 12, 2022)

    Changelog

    Added

    • Press b to switch to a new Branch mode where you can switch between local branches with Space
    • Checkout new branch within gex (b in Branch mode)
    • Exit Branch mode with Esc
    • Init git repository by running gex in a folder that is not a git repository
    • Indication that working tree is clean
    • [DELETE] or [RENAME] indicators in status view

    Changed

    • Esc can no longer be used to exit gex
    • Current branch name is now highlighted in bold

    Fixed

    • gex crashing on attempts to perform actions when working tree clean
    • gex crashing on encountering deleted files

    Full Changelog: https://github.com/Piturnah/gex/blob/master/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Aug 5, 2022)

    Changelog

    Added

    • git status display with diff information and current branch
    • Keyboard navigation between diffs of files and hunks
    • Diff items can be expanded or collapsed with Tab
    • Diff items can be (un)staged one at a time or all at once
    • Status can be refreshed at any time with r
    • Commits can be made from within gex, using git's core.editor
    • Quit gex using q / Esc

    Full Changelog: https://github.com/Piturnah/gex/blob/master/CHANGELOG.md

    Source code(tar.gz)
    Source code(zip)
Owner
Peter Hebden
Student in the UK studying Computer Science and Mathematics.
Peter Hebden
Command-line tool that provides a workflow for extending, editing, diffing, and writing to vim-style grep lines.

Grug Grug is a command-line tool that provides a workflow for expanding, editing, diffing, and writing edits to files using vim-styled grep lines (suc

null 4 Apr 25, 2023
Native cross-platform full feature terminal-based sequence editor for git interactive rebase.

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

Tim Oram 1.2k Jan 2, 2023
AI-TOML Workflow Specification (aiTWS), a comprehensive and flexible specification for defining arbitrary Ai centric workflows.

AI-TOML Workflow Specification (aiTWS) The AI-TOML Workflow Specification (aiTWS) is a flexible and extensible specification for defining arbitrary wo

ruv 20 Apr 8, 2023
A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf.

xplr A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf. [Quickstart] [Features] [Plugins] [Documentation] [Upgrade Guide] [

Arijit Basu 2.6k Jan 1, 2023
🖥 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
A simple library fot creating file explorer for the ratatui crate.

ratatui-explorer ratatui-explorer is a simple library for creating file explorers for ratatui. Features: File explorer functionality. Input handling (

null 5 Feb 29, 2024
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
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
A cross platform minimalistic text user interface

titik Titik is a crossplatform TUI widget library with the goal of being able to interact intuitively on these widgets. It uses crossterm as the under

Jovansonlee Cesar 113 Dec 31, 2022
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
A cross-platform graphical process/system monitor with a customizable interface and a multitude of features

A cross-platform graphical process/system monitor with a customizable interface and a multitude of features. Supports Linux, macOS, and Windows. Inspired by both gtop and gotop.

Clement Tsang 5.8k Jan 8, 2023
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
📺(tv) Tidy Viewer is a cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment.

??(tv) Tidy Viewer is a cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment.

Alex Hallam 1.8k Jan 2, 2023
Cross-platform Rust rewrite of the GNU coreutils

Cross-platform Rust rewrite of the GNU coreutils

null 13k Jan 8, 2023
Rust-battery - Rust crate providing cross-platform information about the notebook batteries.

battery Rust crate providing cross-platform information about the notebook batteries. Table of contents Overview Supported platforms Install Examples

svartalf 326 Dec 21, 2022