Skip to content

Instantly share code, notes, and snippets.

@samuelbezerrab
Created March 22, 2024 12:58
Show Gist options
  • Save samuelbezerrab/ade61a33cde69c9f0f5ea62b08bebbfe to your computer and use it in GitHub Desktop.
Save samuelbezerrab/ade61a33cde69c9f0f5ea62b08bebbfe to your computer and use it in GitHub Desktop.
Checkout all git remote branches
#!/bin/bash
for branch in `git branch -r | grep -v HEAD`;do
git checkout -b $branch $branch
done
@samuelbezerrab
Copy link
Author

To run directly, use:

/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/samuelbezerrab/ade61a33cde69c9f0f5ea62b08bebbfe/raw/316169742ac93d19e7d5f3f91a9faa220f9de33a/git-checkout-all-branches.sh)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment