Last couple weeks I coded a simple bash script to help me out on a simple problem. Have you ever lost track of changes on different projects/repositories? Do you work on a multiple repository project which requires you to frequently update them all?

Most developers I know work in the same situation and end up coding a script to help them out, I'm no different and did the same just in a more generic way. So here is Sweepwip, a bash script that scans out all your git repositories, fetch changes, apply fast-forward mergers, alert you of repositories without remotes defined and so on.

How it works?

Given a directory Sweepwip will search for .git directories and will execute a couple of harmless git commands, reporting some information about the repositories like:

  • Check if there are changes to be pushed to remote
  • Check if there are local changes not committed
  • Check if a remote is defined.
  • Fetch changes from remote (not the default)
  • Apply a fast-forward merge (not the default)

Sweepwip

Code and extensibility

The code is plain bash and git, probably portable across most Unix like OSes. Through a find search different functions are called once a git repository is found. Is possible to easily extend it to execute more commands just by adding more functions.

You can find the code on GitHub.