Mgitstatus

I’m working on several projects at the same time quite often and sometimes I’m loosing track of their states. Which one has uncommitted changes? Which one needs to be updated from an upstream?

It’s not difficult to write a bash oneliner to iterate over projects and run git status for each of them:

1
2
3
4
for project in development/projects/*;
do
    sh -c "cd $project; git status"
done

Well, it is not a oneliner, but just for readability. It might be invoked as a function or as a shell script. Here is an example output of the script:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        public/

nothing added to commit but untracked files present (use "git add" to track)
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
fatal: not a git repository (or any of the parent directories): .git

As you can see, this output is hard to read. It’s too verbose and lack of colors. Actually, you can’t see for which repo the info is printed.

The script above definitely should be improved. Fortunately, it was done already. There are a couple of alternatives like mgitstatus, this script or gr (which, actually, can do much more than just status). Currently I’m using the first one. Here is an example output:

Look much better, doesn’t it?