Skip to content

Instantly share code, notes, and snippets.

@gidgid
Created April 9, 2020 13:17
Show Gist options
  • Save gidgid/59e34f38b831cae06b18d2dfc9c73466 to your computer and use it in GitHub Desktop.
Save gidgid/59e34f38b831cae06b18d2dfc9c73466 to your computer and use it in GitHub Desktop.
Frequently used Git with FZF 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