0

I have a set of git repositories, say 10, in a directory. Would like to have a quick glance at which of them were recently updated, in last say 2 weeks (this will be of course configurable). How to do it?

The update means commit has been made. In other words it's not about pull, it's about: what repositories have fresh commits, locally. Is there some nice method for this?

  • What means updated? Does it mean a commit has been made during that time in an arbitrary branch? What have you tried already? – hek2mgl Feb 13 '16 at 08:18
  • See: [Check if pull needed in Git](http://stackoverflow.com/q/3258243/3776858) – Cyrus Feb 13 '16 at 08:21
  • @hek2mgl: why should I try anything? Why did you down vote, it was you didn't you. –  Feb 13 '16 at 08:47

1 Answers1

0

Copy the below into a script file, e.g. updateCheck.sh:

for directory in `ls -d */`; do
    pushd $directory >/dev/null
    if [ -d ".git" ]; then
        if [[ `git log -1 --all --since=$1` ]];
        then
          echo $directory
        fi
    fi
    popd >/dev/null
done

Run it in the directory that contains all of the repos, and pass as an argument to the script how far back you want to check for updates, e.g. updateCheck.sh 2.weeks, updateCheck.sh 5.days, etc.

David Deutsch
  • 17,443
  • 4
  • 47
  • 54
  • Nice option to this, --max-count=1, correct? Why --all? –  Feb 13 '16 at 14:55
  • @ManaCode - the `--all` checks all branches. Without it, only the currently checked out branch in each repo will be checked. And you are correct about the max count thing; I have edited the answer accordingly. – David Deutsch Feb 13 '16 at 15:02