jwiegley / git-scripts

A bunch of random scripts I've either written, downloaded or clipped from #git.

This URL has Read+Write access

git-scripts / git-current
100755 22 lines (17 sloc) 0.41 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
 
if [[ -z "$1" ]]; then
ancestor=master
else
ancestor=$1
    shift 1
fi
current="$ancestor"
 
ancestor=$(git rev-parse $ancestor)
 
for head in $(git rev-parse --branches); do
if [[ $head != $ancestor ]]; then
if git rev-list -30 $head | grep -q $ancestor; then
current="$current $(git describe --all --abbrev=0 $head | sed 's/heads\///')"
fi
fi
done
 
git show-branch $current