All Projects → wfxr → Forgit

wfxr / Forgit

Licence: mit
💤 A utility tool powered by fzf for using git interactively.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Forgit

Fzf
🌸 A command-line fuzzy finder
Stars: ✭ 40,965 (+2147.12%)
Mutual labels:  fzf, cli, zsh, fish
Z.lua
⚡ A new cd command that helps you navigate faster by learning your habits.
Stars: ✭ 2,164 (+18.71%)
Mutual labels:  fzf, zsh, fish, zsh-plugin
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+142.57%)
Mutual labels:  fzf, cli, zsh, fish
Fzf Widgets
ZLE widgets of fzf
Stars: ✭ 72 (-96.05%)
Mutual labels:  fzf, zsh, zsh-plugin
Kafkactl
Command Line Tool for managing Apache Kafka
Stars: ✭ 177 (-90.29%)
Mutual labels:  cli, zsh, fish
Gitmux
💻 Git in your tmux status bar
Stars: ✭ 180 (-90.13%)
Mutual labels:  cli, zsh, fish
Enhancd
🚀 A next-generation cd command with your interactive filter
Stars: ✭ 2,049 (+12.4%)
Mutual labels:  fzf, cli, zsh
Gh
Easily manage your local git repos
Stars: ✭ 156 (-91.44%)
Mutual labels:  cli, zsh, fish
G
Simple go version manager, gluten-free
Stars: ✭ 307 (-83.16%)
Mutual labels:  cli, zsh, fish
Dotbare
Manage dotfiles and any git directories interactively with fzf
Stars: ✭ 327 (-82.06%)
Mutual labels:  fzf, zsh, zsh-plugin
Twf
Standalone tree view file explorer, inspired by fzf.
Stars: ✭ 196 (-89.25%)
Mutual labels:  fzf, cli, zsh
Autocomplete
Autocomplete for terminals on MacOS
Stars: ✭ 569 (-68.79%)
Mutual labels:  cli, zsh, fish
Awesome Shell
A curated list of awesome command-line frameworks, toolkits, guides and gizmos. Inspired by awesome-php.
Stars: ✭ 22,631 (+1141.42%)
Mutual labels:  cli, zsh, fish
Fzf Tab
Replace zsh's default completion selection menu with fzf!
Stars: ✭ 761 (-58.26%)
Mutual labels:  fzf, zsh, zsh-plugin
Cgitc
Close Git Combat
Stars: ✭ 62 (-96.6%)
Mutual labels:  zsh, fish
Dotfiles
Workstation configuration, provisioning and tools
Stars: ✭ 67 (-96.32%)
Mutual labels:  fzf, zsh
Dotfiles
🏠
Stars: ✭ 60 (-96.71%)
Mutual labels:  zsh, fish
Colorechoforshell
Make 🐚(shell) 's 💬 (`echo`) to be 🌈 easily ✨ Support ✅ sh ➕ bash ➕ zsh ➕ ksh ➕ 🐟
Stars: ✭ 75 (-95.89%)
Mutual labels:  zsh, fish
Iterfzf
Pythonic interface to fzf, a CLI fuzzy finder
Stars: ✭ 106 (-94.19%)
Mutual labels:  fzf, cli
Vg
Virtualgo: Easy and powerful workspace based development for go
Stars: ✭ 1,213 (-33.46%)
Mutual labels:  zsh, fish

💤 forgit

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

pre-commit Contributors

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'

# for fisher
fisher install wfxr/forgit

# for omf
omf install https://github.com/wfxr/forgit

# for zinit
zinit load 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 checkout <branch> selector (gcb)

  • Interactive git checkout <commit> selector (gco)

  • Interactive git stash viewer (gss)

  • Interactive git clean selector (gclean)

  • Interactive git cherry-pick selector (gcp)

  • Interactive git rebase -i selector (grb)

  • Interactive git commit --fixup && git rebase -i --autosquash selector (gfu)

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 - Y Copy commit hash*
Ctrl - K / P Selection move up
Ctrl - J / N Selection move down
Alt - K / P Preview move up
Alt - J / N Preview move down

* Available when the selection contains a commit hash. For linux users FORGIT_COPY_CMD should be set to make copy work. Example: FORGIT_COPY_CMD='xclip -selection clipboard'.

Options

aliases

shell

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_checkout_file=gcf
forgit_checkout_branch=gcb
forgit_checkout_commit=gco
forgit_clean=gclean
forgit_stash_show=gss
forgit_cherry_pick=gcp
forgit_rebase=grb
forgit_fixup=gfu

git

You can use git aliases by making git-forgit available in $PATH:

# after `forgit` was loaded
export PATH="$PATH:$FORGIT_INSTALL_DIR/bin"

Some plugin managers can help do this.

Then any forgit command will be a subcommand of git:

$ git forgit log
$ git forgit add
$ git forgit diff

Optionally you can add aliases in git:

git config --global alias.cf 'forgit checkout_file'

And use the alias in git:

git cf

pagers

Forgit will use the default configured pager from git (core.pager, pager.show, pager.diff) but can be altered with the following environment variables:

Use case Option Fallbacks to
common pager FORGIT_PAGER git config core.pager or cat
pager on git show FORGIT_SHOW_PAGER git config pager.show or $FORGIT_PAGER
pager on git diff FORGIT_DIFF_PAGER git config pager.diff or $FORGIT_PAGER
pager on gitignore FORGIT_IGNORE_PAGER bat -l gitignore --color always or cat
git log format FORGIT_GLO_FORMAT %C(auto)%h%d %s %C(black)%C(bold)%cr%reset

fzf options

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_FILE_FZF_OPTS
gcb FORGIT_CHECKOUT_BRANCH_FZF_OPTS
gco FORGIT_CHECKOUT_COMMIT_FZF_OPTS
gss FORGIT_STASH_FZF_OPTS
gclean FORGIT_CLEAN_FZF_OPTS
grb FORGIT_REBASE_FZF_OPTS
gfu FORGIT_FIXUP_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)

Examples:

  • ctrl-d to drop the selected stash but do not quit fzf (gss specific).
FORGIT_STASH_FZF_OPTS='
--bind="ctrl-d:reload(git stash drop $(cut -d: -f1 <<<{}) 1>/dev/null && git stash list)"
'
  • ctrl-e to view the logs in a vim buffer (glo specific).
FORGIT_LOG_FZF_OPTS='
--bind="ctrl-e:execute(echo {} |grep -Eo [a-f0-9]+ |head -1 |xargs git show |vim -)"
'

other options

Option Description Default
FORGIT_LOG_FORMAT git log format %C(auto)%h%d %s %C(black)%C(bold)%cr%Creset

📦 Optional dependencies

💡 Tips

  • Most of the commands accept optional arguments (eg, glo develop, glo f738479..188a849b -- main.go, gco master).
  • 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++).
  • You can use the commands as sub-commands of git, see #147 for details.

📃 License

MIT (c) Wenxuan Zhang

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].