Skip to content

Instantly share code, notes, and snippets.

@aaomidi
Created November 20, 2023 01:44
Show Gist options
  • Save aaomidi/baaeeaa48937066f39cc8e9405d92c54 to your computer and use it in GitHub Desktop.
Save aaomidi/baaeeaa48937066f39cc8e9405d92c54 to your computer and use it in GitHub Desktop.
Organize your github clones automatically
#!/usr/bin/env bash
# Extract the organization and repo name from the argument
ORG=$(echo "$1" | cut -d '/' -f 1)
REPO=$(echo "$1" | cut -d '/' -f 2)
# Define the base directory
BASE_DIR="$HOME/Projects"
# Create the directory structure
mkdir -p -- "$BASE_DIR/$ORG"
# Clone the repo into the specified directory
gh repo clone "$1" "$BASE_DIR/$ORG/$REPO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment