mirror of
https://github.com/git/git.git
synced 2024-11-17 06:25:13 +01:00
7c27558c62
Often I find myself wanting to do quick branches check when I am not in the windowing environment and cannot run gitk. This stupid script shows commits leading to the heads of interesting branches with indication which ones belong to which branches, so that fork point is somewhat discernible without using gitk. Signed-off-by: Junio C Hamano <junkio@cox.net>
53 lines
777 B
Bash
Executable file
53 lines
777 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Show refs and their recent commits.
|
|
#
|
|
|
|
. git-sh-setup-script || die "Not a git repository"
|
|
|
|
headref=`readlink $GIT_DIR/HEAD`
|
|
case "$#" in
|
|
0)
|
|
set x `cd $GIT_DIR/refs &&
|
|
find heads -type f -print |
|
|
sed -e 's|heads/||' |
|
|
sort`
|
|
shift ;;
|
|
esac
|
|
|
|
hh= in=
|
|
for ref
|
|
do
|
|
case "/$headref" in
|
|
*/"$ref") H='*' ;;
|
|
*) H='!' ;;
|
|
esac
|
|
h=`git-rev-parse --verify "$ref^0"` || exit
|
|
l=`git-log-script --max-count=1 --pretty=oneline "$h" |
|
|
sed -e 's/^[^ ]* //'`
|
|
hh="$hh $h"
|
|
echo "$in$H [$ref] $l"
|
|
in="$in "
|
|
done
|
|
set x $hh
|
|
shift
|
|
|
|
git-rev-list --pretty=oneline "$@" |
|
|
while read v l
|
|
do
|
|
in=''
|
|
for h
|
|
do
|
|
b=`git-merge-base $h $v`
|
|
case "$b" in
|
|
$v) in="$in+" ;;
|
|
*) in="$in " ;;
|
|
esac
|
|
done
|
|
|
|
echo "$in $l"
|
|
case "$in" in
|
|
*' '*) ;;
|
|
*) break ;;
|
|
esac
|
|
done
|