-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgit-statuscrazy.sh
executable file
·44 lines (42 loc) · 1.46 KB
/
git-statuscrazy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# for all git repos, do `git status` and summarize the result
#
# tip: put this in your ~/.gitconfig
# statuscrazy = !"find . -type d -name .git -execdir path/to/this \\;"
#
# and in some dir containing many git repos, use like:
# % git statuscrazy
#
# output like:
# bbjshint's master ahead 'my/master' by 1 (clean)
# bbjslint's master ahead 'my/master' by 1 (clean)
# bbresults's master ahead 'my/master' by 3 (clean)
# git-heads's master (clean)
# relnote's master (clean)
# shell's master (untracked)
# dotfiles's master (unstaged)
# regex-router's master (unstaged)
# cuppajoe's conf (clean)
# myfork's develop (clean)
# mojito-0.5.3's develop (clean)
# assembler's master (clean)
# photosnear.me's master (clean)
# resource-locator's master (untracked)
# ricloc's master (staged) (unstaged) (untracked)
# touchdown's master (clean)
# wiki's master (clean)
# assemb's master (unstaged)
# bearing's develop (unstaged)
# fooapp's master (unstaged)
# mojitokit's master (staged)
# piegist's master (clean)
# scanfs's develop (unstaged)
/bin/echo -n "$(basename $(pwd))'s "
git status | perl -n \
-e 'm/^# On branch (\w+)/ && print $1;'\
-e 'm/nothing to commit, working directory clean/ && print " (clean)";'\
-e 'm/(ahead|behind) of (\S+) by (\d+) commit/ && print " $1 $2 by $3";'\
-e 'm/^# Changes not staged/ && print " (unstaged)";'\
-e 'm/^# Changes to be committed/ && print " (staged)";'\
-e 'm/^# Untracked files/ && print " (untracked)";'
echo