amtoine / nu-git-manager

A collection of Nushell tools to manage Git repositories.
GNU General Public License v3.0
26 stars 2 forks source link
git library nushell repository-management vcs

nu-git-manager

A collection of Nushell tools to manage git repositories.

Table of content

:bulb: what is nu-git-manager [toc]

like ghq, nu-git-manager aims at being a fully-featured repository manager, purely written in Nushell.

it provides two main modules:

:link: requirements [toc]

:recycle: installation [toc]

Note if you are using the latest stable release of Nushell, then you should install nu-git-manager from the main branch, i.e. by default.

if you want to use the latest and hotest builds of Nushell, either by building from source yourself or using the nightly builds, you might want to checkout the nightly branch and install from there. this alternative branch should contain all fixes and newest features from the latest versions of Nushell :fire:

:gear: usage [toc]

in your config.nu you can add the following to load nu-git-manager modules:

# load the main `gm` command
use nu-git-manager *

# the following are non-essential modules
use nu-git-manager-sugar extra *              # augment `gm` with additional commands

Note
please have a look at the documentation of NGM for more modules and commands

then you have access to the whole nu-git-manager suite :partying_face:

:pray: getting help [toc]

please have a look at the documentation of NGM

:exclamation: some ideas of advanced (?) usage [toc]

everytime i open a terminal, i use [Tmux] to manage sessions, switch between them, detach and reattach, quite a BLAZZINGLY FAST workflow for my taste :smirk:

to achieve this, i use the [tmux-sessionizer.nu script][tmux-sessionizer.nu], again installed with [Nupm] :ok_hand:

then, in my Tmux config, i have a binding to

  1. list all my Git repositories
  2. fuzzy-pick one of them with the [main command of tmux-sessionizer.nu][tmux-sessionizer.nu]
  3. create or reattach to the session associated with the repository
    
    # ~/.config/tmux/tmux.conf

NUPM_HOME="~/.local/share/nupm" TMUX_SESSIONIZER="$NUPM_HOME/scripts/tmux-sessionizer.nu"

bind-key -r t display-popup -E "nu --commands ' use $NUPM_HOME/modules/nu-git-manager *;\ $TMUX_SESSIONIZER (gm list --full-path) --short\ '"



[Nushell]: https://github.com/nushell/nushell

[Nupm]: https://github.com/nushell/nupm
[Nupm instructions]: https://github.com/nushell/nupm#-installation

[Tmux]: https://github.com/tmux/tmux
[`tmux-sessionizer.nu`]: https://github.com/amtoine/tmux-sessionizer