GIT: Check current projects branches

The next one-line command can show you all GIT branches for all developed projects:

echo -e "$(find ~/hosts -maxdepth 5 -name ".git" \ -exec echo -n "{} " \; \ -exec touch "{}/HEAD" \; \ -exec sed "s/\(production\)/\\\\033[01;41m\1\\\\033[00m/" "{}/HEAD" \;)" | \ sed 's/\(\.git \)\//\1 ! no .git\/HEAD file\n\//; s/\/\.git / /'
The first echo highlight warning of first sed execution, in my case the branch “production” is impossible on developers repositories.
And I make limit by maxdepth attribute to keep fast searching.

Leave a Reply

Your email address will not be published. Required fields are marked *