Skip to content

Instantly share code, notes, and snippets.

@VeikkoLehmuskorpi
Last active March 6, 2023 10:48
Show Gist options
  • Select an option

  • Save VeikkoLehmuskorpi/670a0630cee3ed6e38a7a4a3c0dae1e2 to your computer and use it in GitHub Desktop.

Select an option

Save VeikkoLehmuskorpi/670a0630cee3ed6e38a7a4a3c0dae1e2 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Checkout a local branch with fzf
branch=$(git for-each-ref refs/heads --format='%(refname:short)'|fzf)
if [ -n "$branch" ]; then
git checkout "$branch"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment