A collection of useful scripts and instructions for everyday development tasks.
Shell scripts for batch operations on multiple local repositories:
| Script | Description |
|---|---|
git/currentBranchInfoAll.sh |
Print current branch for every git repository in the current directory |
git/pullAll.sh |
Run git pull on every git repository in the current directory |
Windows CMD equivalents (in git/windows_cmd/):
| Script | Description |
|---|---|
git/windows_cmd/pull_all_repos_from_subdirs.bat |
git pull origin on every subdirectory |
git/windows_cmd/all_repos_from_subdirs_checkout_master_branch.bat |
Checkout master branch in every subdirectory |
git/clone_all_repos.py — clone all GitHub repositories
owned by the authenticated user into an organized directory structure.
Repositories that already exist in the target directory are skipped, so the
script is safe to run repeatedly (e.g. to pick up newly created repos).
<target_dir>/
├── public/ # public repositories
├── private/ # private repositories
│ └── shared/ # private repos shared with outside collaborators
└── profile/ # the user's profile repo (username/username)
Setup:
- Create a fine-grained personal access token at https://github.com/settings/tokens
- Token configuration:
- Repository Access → All repositories
- Permissions → Contents: read-only, Administration: read-only
- Save the token as
GITHUB_API_KEYin a.envfile
Usage:
pip install requests python-dotenv
python git/clone_all_repos.py USERNAME [TARGET_DIR] # SSH (default)
python git/clone_all_repos.py USERNAME [TARGET_DIR] --https # HTTPS with tokenHandy one-liners collected in commands.md.
Step-by-step guides: