These are some scripts that I use constantly when dealing with multiple git repositories.
This script is typically run from the common parent directory. Currently, they are hardcoded to -only peek into the first level of child directories-, find all sub-directories that are git repositories and run the specified commands.
With the latest update, the run_all
script can be configured to run against any level of subdirectory. Examples:
run_all git status # to get the git status of all git repos
run_all git clean -fxd # to clean all git repos
run_all git remote prune origin # to run the git remote prune command
run_all git add -p # to add all modified (unstaged) files for a commit eventually
run_all find . -iname patch.txt --exec rm -rfv {} \; # find all files with the name 'patch.txt'
Note: Any command can be run whether they are specific to the shell that you are currently using or git commands. These commands are run within the context of each child git repository.
Script to permanently delete files/folders from your git repository. To use it, cd to your repository's root and then run the script with a list of paths you want to delete, e.g., git-delete-history path1 path2
Script to cleanup all installed gems (if you do not want to simply delete the gem install directory)
Script to clone all remote branches onto your local machine. Useful if you are a person who wants to run diffs, and other analytics on the git logs across different branches.
After merging local changes into branches and pushing them to the respective remote-tracking branches, you might want to clean your local machine. This script is used to ensure the first is done and then will cleanly delete the synced branches from local.
Script to see how much disk space each folder/item in your git repo is holding
If you want to reclone a branch from remote since your local copy is messed up somehow.
If you want to recreate a tag and push the new version to remote since your local copy is messed up somehow.
Powershell clone of the run_all
- but, as yet, unmaintained since I do not have access to a Windows machine.