Last active
August 19, 2021 09:54
-
-
Save artlantis/fea385464828554253c2d66b56bc64c6 to your computer and use it in GitHub Desktop.
Revisions
-
artlantis renamed this gist
Aug 19, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
artlantis created this gist
Aug 19, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/bin/bash # Steps to clone all branchs from remote repository to local directory # # mkdir work-dir-name # cd work-dir-name # git clone --bare remote-repository-url repo-name && cd repo-name # git config --bool core.bare false # git reset --hard # change the 'grep -E' filter with appropiate repository names that you want to download # change the target directory name in tar command # chmod +X get-all-remote-branchs.sh # sh get-all-remote-branchs git clone --bare https://remote-repository.url/repository-name repository-name && cd repository-name git for-each-ref --format='%(refname)' refs/heads/ | grep -E '(master)|(CHALLENGE)|(LECTURES-.*)' | while read branchRef; do branchName=${branchRef#refs/heads/} git archive --format=tar --prefix="$branchName/" "$branchRef" | tar -Cd:/target-directory-name -x done