Skip to content

Instantly share code, notes, and snippets.

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

  • Save VeikkoLehmuskorpi/189a55ecb120c7e3da01e33968f37d00 to your computer and use it in GitHub Desktop.

Select an option

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