Git Product home page Git Product logo

forgit's Introduction

๐Ÿ’ค forgit

Utility tool for using git interactively. Powered by junegunn/fzf.

This tool is designed to help you use git more efficiently. It's lightweight and easy to use.

๐Ÿ“ฅ Installation

Make sure you have fzf installed.

# for zplug
zplug 'wfxr/forgit'

# for zgen
zgen load 'wfxr/forgit'

# for antigen
antigen bundle 'wfxr/forgit'

# manually
# Clone the repository and source it in your shell's rc file.

You can run the following command to try forgit without installing:

# for bash / zsh
source <(curl -sSL git.io/forgit)
# for fish
source (curl -sSL git.io/forgit.fish | psub)

๐Ÿ“ Features

  • Interactive git add selector (ga)

screenshot

  • Interactive git log viewer (glo)

screenshot

The log graph can be disabled by option FORGIT_LOG_GRAPH_ENABLE (see discuss in issue #71).

  • Interactive .gitignore generator (gi)

screenshot

  • Interactive git diff viewer (gd)

  • Interactive git reset HEAD <file> selector (grh)

  • Interactive git checkout <file> selector (gcf)

  • Interactive git stash viewer (gss)

  • Interactive git clean selector (gclean)

โŒจ Keybinds

Key Action
Enter Confirm
Tab Toggle mark and move up
Shift - Tab Toggle mark and move down
? 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

โš™ Options

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

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

Complete loading order of fzf options is:

  1. FZF_DEFAULT_OPTS (fzf global)
  2. FORGIT_FZF_DEFAULT_OPTS (forgit global)
  3. FORGIT_CMD_FZF_OPTS (command specific)

Example

# adds a keybind to drop the selected stash but do not quit fzf
FORGIT_STASH_FZF_OPTS='
--bind="ctrl-d:reload(git stash drop $(cut -d: -f1 <<<{}) 1>/dev/null && git stash list)"
'

๐Ÿ“ฆ Optional dependencies

๐Ÿ’ก Tips

  • Hit q to quit from full screen preview any time.
  • Commands like glo, gd, gcf and gclean accept arguments to restrain the items listed in fzf(eg, glo develop, glo f738479..188a849b -- main.go, gclean output/ etc.).
  • 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

forgit's People

Contributors

wfxr avatar doronbehar avatar gerrit-k avatar laggardkernel avatar nothingelsematters avatar benavern avatar sohkai avatar carlosedp avatar oakninja avatar michaelmior avatar attomos avatar pawamoy avatar wemyss avatar yifeikong avatar mars90226 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.