Skip to content

Commit

Permalink
feat: Function for pulling GitHub user's entire repo catalogue
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpovel committed Dec 18, 2023
1 parent 02800f3 commit bd2e3b3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions home/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,25 @@ export ZSH_COLORIZE_STYLE="dracula"
# example. Works with Tab completion.
alias rr='git rev-parse --show-toplevel 2>/dev/null || pwd'

pullall() {
gh auth status 1>/dev/null 2>&1 || gh auth login

local USER="$1"

gh repo list "$USER" --limit 1000 | while read -r repo _; do
gh repo clone "$repo" "$repo" || (
cd "$repo"

for branch in 'main' 'master' 'dev' 'devel'; do
# Need to be on a branch to pull; first one found wins.
git switch "$branch" && break
done

git pull --all || echo "Failed to pull $repo"
)
done
}

# =====================================================================================
# Custom aliases
# =====================================================================================
Expand Down

0 comments on commit bd2e3b3

Please sign in to comment.