It is a common workflow to run "git fetch; git rebase origin/<foo>" Where
foo is the remote tracking branch. git-rebase should default to using
the remote tracking branch if no other ref is given.
Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
---
git-rebase.sh | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 058fcac..1a2b51b 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -261,8 +261,19 @@ case "$diff" in
;;
esac
-# The upstream head must be given. Make sure it is valid.
upstream_name="$1"
+# Default to the remote tracking branch if we have one
+if [ -z "$upstream_name" ]
+then
+ curr_branch=$(git symbolic-ref -q HEAD)
+ curr_branch=${curr_branch//refs\/heads\//}
+ merge=$(git config branch.$curr_branch.merge)
+ remote=$(git config branch.$curr_branch.remote)
+ fetch=$(git config remote.$remote.fetch)
+
+ expanded=$(git fetch--tool expand-refs-wildcard "0000000000000000000000000000000000000000 $merge" "$remote" "$fetch")
+ upstream_name=${expanded/#*:/}
+fi
upstream=`git rev-parse --verify "${upstream_name}^0"` ||
die "invalid upstream $upstream_name"
--
1.5.3.4.1.gb4ad62-dirty
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html