Created
July 6, 2018 08:39
-
-
Save reneweteling/4524e2500a69755c170feeca6b1221b1 to your computer and use it in GitHub Desktop.
Little command to print all git branches of all folders in specified location
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Author: René Weteling | |
# Email: [email protected] | |
# Description: Command to list all branches of all folders at a specified | |
# locaton. Handy if you have multiple projects. | |
# Installation: | |
# 1 - Store in your path (usually ~/bin/gitbranches) | |
# 2 - Make executable (chmod +x gitbranches) | |
# 3 - Source your terminal, and enjoy (gitbranches [path || '.']) | |
path = ARGV[0] || '.' | |
path = "#{Dir.pwd}/#{path}" unless path[0] == '/' | |
def print_git_branches(dir) | |
puts "\033[0;42;30m#{dir}\033[0m" | |
puts `cd #{dir} && git branch --list` | |
end | |
Dir | |
.glob("#{path}/*") | |
.select { |f| File.directory? f } | |
.each{|f| print_git_branches f } |
Author
reneweteling
commented
Jul 6, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment