Last active
November 18, 2024 13:33
-
-
Save TheLime1/bf73bed71cac051980d8b0fb9c2975f7 to your computer and use it in GitHub Desktop.
Download a repo and all its branches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clone the repository | |
git clone https://github.com/user/repo | |
# Change directory to the cloned repository | |
cd repo | |
# Fetch all branches | |
git fetch --all | |
# Create a directory to store branches | |
mkdir ../repo-branches | |
# Loop through each branch and clone it into a separate folder | |
for branch in $(git branch -r | grep -v '\->' | grep -v 'HEAD' | sed 's/origin\///'); do | |
git clone --branch $branch https://github.com/user/repo ../repo-branches/$branch | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment