Managing Many Git Repositories on Computer can be quite pathetic if you are using lot of Cloud PaaS like AppFog, Heroku Cloud or you have lot of GitHub repo. GitHub has own tools but that is only for GitHub. This guide on Managing Many git Repositories is for them who already are advanced users or want to experiment in the way we pointed in previous guide on Easy Guide to Use Git.
Managing Many git Repositories on Computer : Why it Matters
Normally Git repo’s sits on username folder :
The red boxed folders are git repositories. From the screenshot one thing will be apparant to you – if you have few hundreds to few thousands of git repositories, it will be a pain to manage. In other word, they need a proper directory, subdirectory structure under the username. Actually you might not want move the repositories which are already pushed to avoid huge pain. Now you probably have understood why we named the guide as – Managing Many git Repositories on Computer.
---
Managing Many git Repositories on Computer : Command Line Tools and GUI Based Tools
First, delete the git repositories which are empty by recursively deleting the folders :
1 | rm -rf directoryname |
Second, there are bash scripts available for managing many Git Repositories like :
1 2 | #!/bin/sh if [ ! "$1" = "" ] ; then |
1 2 3 | if [ "$GITREPO" = "" -a -d "$HOME/cm/src" ] ; then GITREPO="$HOME/cm/src" fi |
1 | if [ "$GITREPO" != "" ] ; then |
1 2 | echo "Git repositories found in $GITREPO" echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-" |
1 | DIRS="`/bin/ls -1 $GITREPO`" |
1 | for dir in $DIRS ; do |
1 2 3 4 5 | if [ -d $GITREPO/$dir/.git ] ; then echo "$dir -> git $1" cd $GITREPO/$dir ; git $@ echo fi |
1 2 | done else |
1 | echo "Git repositories not found." |
1 2 | fi fi |
And run it. Other than bash scripts, you can use Gitslave :
1 | http://gitslave.sourceforge.net/ |
Managing Many git Repositories on Computer can be done with GUI based tools too :
Two such tools are :
1 | http://gitboxapp.com/ |
1 | http://www.gittiapp.com/ |
Tagged With managing many git repositories on computer , tips for managing many git repositories on one windows machine