Do you have hundreds of git repositories on your laptop? Have you ever wondered how many useful bits of code you’ve forgotten to check in? check-git is here to answer that question.

Here’s an example. I ran check-git in a terminal, and it showed me the repositories in this somewhat fictitious directory.

$ check-git
Arduino Sketchbook/libraries/UniWS
   M src/UniWS.cpp

Blink Eras
  Your branch is ahead of 'origin/master' by 1 commit.
  ?? Gimp/555 1971.png
  ?? KiCAD/BlinkyFeet.pretty/Mushroom.kicad_mod
  stash@{0}: WIP on master: da5589c README: added link for KiCAD graphics tutorial.

Repositories without Remotes
  Done for Now/DSLR Automation/git/test

Branched Repositories
       kb Laser/Other Lasers/Software/LasaurApp
     laos Laser/Other Lasers/laoslaser/pstoedit
  impulse Rostock MAX/git/RepetierMAX

Clean Repositories:
  Arduino Sketchbook/libraries/PWMServo
  Done for Now/DSLR Automation/git/test
  Done for Now/DSP-G1/Audio
  Done for Now/Printed Objects/Automatic Transmission/MCAD
  Laser/Other Lasers/laoslaser/AddOns
  Laser/Other Lasers/laoslaser/Documentation
  Laser/Other Lasers/laoslaser/Firmware
  Laser/Other Lasers/laoslaser/Hardware
  Laser/Other Lasers/laoslaser/Software
  Laser/Other Lasers/laoslaser/laoslaser.github.com
  Rostock MAX/git/RAMBo
  Rostock MAX/git/Repetier-Firmware
  Rostock MAX/git/RostockMAX
  Rostock MAX/git/Slic3r
  Workbench

If the output looks familiar, it should. check-git runs git status, parses its output, and collates the results.

In the first repository, UniWS, there is one changed file. The second, Blink Eras, has three problems: two untracked files, an old stash, and changes that haven’t been pushed upstream.

Next, check-git lists repositories that have no remotes. Those repositories would be lost if I lost my laptop or its disk.

Then, we see repositories with branches other than master checked out. They

Finally, there’s some good news. There are fifteen clean repositories. They have no changed or untracked files and no stashes. They have branch master checked out, and have had everything pushed to their remotes.

Git checked.

check-git is now on github. Enjoy!

What a Mess!

So now I know what a mess my laptop is in.

  • 208 repositories
  • 296 untracked files
  • 15 changed files
  • four stashes
  • one detached HEAD
  • 18 repos on branches
  • 39 repos without remotes
  • 56 clean repos

I think I’ll go check something in now.

Discuss this post in the pull requests. (-: