Skip to content

Commit 61814c9

Browse files
Merge pull request #4 from richardkchapman/gitparent
Added git-parent
2 parents 383ce47 + 7babfed commit 61814c9

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

rkc/git-parent

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Work out which candidate branch this one was probably forked from
4+
5+
best=1000000
6+
parent=
7+
8+
for candidate in `git branch | grep ' candidate-' | sed 's/\*//'` master ; do
9+
delta=$(git rev-list --count --no-merges $candidate...HEAD)
10+
#echo $candidate : $delta
11+
if [ $delta -lt $best ] ; then
12+
best=$delta
13+
parent=$candidate
14+
fi
15+
done
16+
if [ -z $parent ] ; then
17+
exit 2
18+
fi
19+
echo $parent

rkc/git-pr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "$#" -ge 1 ] ; then
55
into=$1
66
shift 1
77
else
8-
into=master
8+
into=$(git parent)
99
fi
1010
remote="$(git remote | grep rkc)"
1111
if [ "$remote" = "" ]; then

rkc/git-update

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else
99
fi
1010
echo "Fetching data from $remote"
1111
git fetch $remote
12-
for candidate in `git branch | grep ' candidate-' | sed 's/\*//'` master stable
12+
for candidate in `git branch | sed 's/\*/ /' | grep -E ' candidate-| master$| stable$' | sed 's/\*//'`
1313
do
1414
git merge-ff -q $candidate $remote/$candidate
1515
done

0 commit comments

Comments
 (0)