Marek Gibney

Scan the status of multiple git repos

Often I wake up in the morning and think "I worked on a bunch of stuff yesterday. Did I commit all my changes?". Today I automated the "git status dance" by putting this function in my bashrc.

It finds all repos below the current dir and displays the ones that have changes.

showAllReposWithChanges() {
  for n in `find -name .git`
    do (
      cd ${n/%.git/}
      if [ "$(git status --porcelain)" ]
        then echo $PWD
      fi
    )
    done
}