Skip to content
💤 Fuzzy git
Shell
Branch: master
Clone or download
wfxr Merge pull request #32 from Gerrit-K/silence-reset
Added -q flag for git reset HEAD
Latest commit 106c1f8 Aug 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Clean up. Jan 22, 2019
README.md docs: ✏️ Misc Aug 6, 2019
forgit.plugin.sh Refactor & Share code between zsh & sh. Jan 17, 2019
forgit.plugin.zsh Added -q flag for git reset HEAD Aug 26, 2019

README.md

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

grh

Interactive git reset HEAD <file> selector

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
Alt - W Toggle preview wrap
Ctrl - S Toggle sort
Ctrl - R Toggle selection
Ctrl - K / P Selection move up
Ctrl - J / N Selection move down
Alt - K / P Preview move up
Alt - J / N Preview move 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_reset_head=grh
forgit_ignore=gi
forgit_restore=gcf
forgit_clean=gclean
forgit_stash_show=gss

You can add default 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%'
"

Customizing fzf options for each command individually is also supported:

Command Option
ga FORGIT_ADD_FZF_OPTS
glo FORGIT_LOG_FZF_OPTS
gi FORGIT_IGNORE_FZF_OPTS
gd FORGIT_DIFF_FZF_OPTS
grh FORGIT_RESET_HEAD_FZF_OPTS
gcf FORGIT_CHECKOUT_FZF_OPTS
gss FORGIT_STASH_FZF_OPTS
gclean FORGIT_CLEAN_FZF_OPTS

The full loading order of fzf options is:

FZF_DEFAULT_OPTS(fzf global) -> FORGIT_FZF_DEFAULT_OPTS(forgit global) -> FORGIT_CMD_FZF_OPTS(command specific).

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/).
  • gd supports specifying revision(eg, gd HEAD~, gd v1.0 README.md).
  • Call gi with arguments to get the wanted .gitignore contents directly(eg, gi cmake c++).

License

MIT (c) Wenxuan Zhang

You can’t perform that action at this time.