Customizable and lightweight git front end tool. Included shell completions and many interesting looking options.
Go to file
2019-05-29 09:32:17 +03:00
forgit.plugin.sh Refactor & Share code between zsh & sh. 2019-01-17 19:20:03 +08:00
forgit.plugin.zsh Add documentation and align it with actual functionality 2019-05-29 09:32:17 +03:00
LICENSE Clean up. 2019-01-22 11:25:38 +08:00
README.md Add documentation and align it with actual functionality 2019-05-29 09:32:17 +03:00

forgit

License: MIT

forgit is a utility tool for git taking advantage of fuzzy finder fzf.

Installation

Make sure you have fzf installed.

Try Online

Run following command in your shell to try forgit without installing(for both bash and zsh):

source <(curl -Ss https://raw.githubusercontent.com/wfxr/forgit/master/forgit.plugin.zsh)

Zplug

zplug 'wfxr/forgit'

Zgen

zgen load 'wfxr/forgit'

Antigen

antigen bundle 'wfxr/forgit'

Manually

Download and source forgit.plugin.zsh or forgit.plugin.sh in your shell config.

Commands

ga

Interactive git add selector

screenshot

glo

Interactive git log viewer

screenshot

gi

Interactive .gitignore generator

screenshot

gd

Interactive git diff viewer

gcf

Interactive git checkout <file> selector

gss

Interactive git stash viewer

gclean

Interactive git clean selector

Default keybinds

Keybind Action
Enter Confirm
Tab Toggle mark
? Toggle preview window
Ctrl - S Toggle sort
Ctrl - R Toggle selection
Alt - W Toggle preview wrap
Ctrl - K / P Selection up
Ctrl - J / N Selection down
Alt - K / P Preview up
Alt - J / N Preview down

Custom options

You can change the default aliases by defining these variables below. (To disable all aliases, Set the FORGIT_NO_ALIASES flag.)

# Define them before sourcing the plugin if you don't use any plugin manager.
forgit_log=glo
forgit_diff=gd
forgit_add=ga
forgit_ignore=gi
forgit_restore=gcf
forgit_clean=gclean
forgit_stash_show=gss

You can add custom fzf options for forgit, including keybinds, layout, etc. (No need to repeat the options already defined in FZF_DEFAULT_OPTS)

FORGIT_FZF_DEFAULT_OPTS="
--exact
--border
--cycle
--reverse
--height '80%'
"

You can also customize options fzf will use for each command individually:

  • ga: FORGIT_ADD_FZF_OPTS
  • glo: FORGIT_LOG_FZF_OPTS
  • gi: FORGIT_IGNORE_FZF_OPTS
  • gd: FORGIT_DIFF_FZF_OPTS
  • gcf: FORGIT_CHECKOUT_FZF_OPTS
  • gss: FORGIT_STASH_FZF_OPTS
  • gclean: FORGIT_CLEAN_FZF_OPTS

Optional

Tips

  • Hit q to quit from full screen preview any time.
  • Commands like glo, gd, gcf and gclean accept path arguments to restrain the items listed in fzf(eg, glo main.go test.go, gclean output/).
  • Call gi with arguments to get the wanted .gitignore contents directly(eg, gi cmake c++).

License

MIT (c) Wenxuan Zhang