Skip to content

Instantly share code, notes, and snippets.

@gidgid
Created March 31, 2020 19:25
Show Gist options
  • Save gidgid/6246aa2145ec8f7c03eba09fa28d070d to your computer and use it in GitHub Desktop.
Save gidgid/6246aa2145ec8f7c03eba09fa28d070d to your computer and use it in GitHub Desktop.
A handful of FZF Git aliases
# Navigate to branches using FZF
cof = "!checkout_fzf() { git branch | fzf | xargs git checkout; }; checkout_fzf"
# Add files using FZF
af = "!add_fzf() { git status -s | awk '{print $2}' | fzf -m | xargs git add; }; add_fzf"
# Add files using FZF and immediately commit them
afmend = "!add_fzf_amend() { git status -s | awk '{print $2}' | fzf -m | xargs git add && git amend; }; add_fzf_amend"
# Restore files (like removing multiple files from the staging area)
ref = "!restore_fzf() { git status -s | awk '{print $2}' | fzf -m | xargs git restore; }; restore_fzf"
# Delete untracked files using FZF
rmf = "!delete_untracked() { git ls-files --exclude-standard --other | fzf -m | xargs rm; }; delete_untracked"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment