3

I'd like a piece of software that gives me a "dashboard"-like readout for all of my git repositories on my local machine.

I imagine it could tell me statstics like:

  • how many files are not yet managed by git
  • how many lines of diffs are not yet committed
  • how many commits are not yet pushed to each upstream repo
  • how many commits I have not yet pulled from upstream

Those last two would be kind of expensive and probably should be calculated in the background.

Something like a compact and pretty version of

find $HOME /homes7/contracts/ -name .git -print | while read dir; do 
  d=`dirname $dir` 
  echo $d
  ( cd $d; git status)
  echo 
done

Since I have 90+ repos already, this readout needs to be pretty compact. A GUI would be delicious (and opens up the possibility for increased detail on mouse-over or click), but if none exist I will settle for a command-line tool. I use Linux exclusively.

1

I put the status in a text file under ~/status/git-repos.txt. Here is the shell function I use:

function cron_lib_find_git_repo_status_in {
    nice -n 19 find "$*" -name '.git' -print -execdir git status --porcelain --branch \; -execdir git diff --numstat \; |
        grep -v '## master$' &>> "$HOME/status/git-repos.txt"
}

Initialize the file and pass it some directories like this:

date > "$HOME/status/git-repos.txt"
cron_lib_find_git_repo_status_in "$HOME/src/"
cron_lib_find_git_repo_status_in "$HOME/Dropbox/"

Then run that script in a cronjob. The output will contain the branch (excluding boring old ## master), the modified files, and how many line are added or removed.

It's pretty compact, and it's easy to tell big changes from little changes.

  • This is a really good script, but when I run it I realize just how intractable text is when dealing with as many repositories as I have. I'm beginning to think that a GUI (or HTML variation derived from your techniques) might be the only acceptable solution. – Mutant Bob Oct 9 '15 at 17:43
0

There is a more robust option called myrepos that is in the standard repositories.

https://myrepos.branchable.com/

This requires you to register all your repos (unlike the shell script above).

$ mr register
Registering git url: git://my-git-url.com/path/to/repo.git in /home/username/.mrconfig

You can then use command like mr status or mr diff to see all the repos. This runs pretty quickly; I can check the status of 64 repositories in nearly half a second with a slow hard drive.

$ cd $HOME
$ mr status
<snip>
mr status: finished (64 ok)

real    0m0.674s
user    0m0.268s
sys     0m0.080s

The mr package supports git as well as a variety of other version control systems, but note that you must have at least one remote url, i.e. purely local repositories don't really work. There is a workaround mentioned here if you're curious:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=645965

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.