From 6a757687c5c6db3cdbb921ba7e55871b4a291973 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Tue, 13 Dec 2011 12:40:36 +0800 Subject: [PATCH] Fixed git_set_default_remote to use current branch for default --- lib/git/tools.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/git/tools.sh b/lib/git/tools.sh index 9b368a0..23ca270 100644 --- a/lib/git/tools.sh +++ b/lib/git/tools.sh @@ -33,7 +33,8 @@ git_remove_history() { # Set default remote and merge for a git branch (pull and push) # Usage: git_set_default_remote(branch = master, remote = origin) git_set_default_remote() { - if [ -n "$1" ]; then branch="$1"; else branch="master"; fi + curr_branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') + if [ -n "$1" ]; then branch="$1"; else branch="$curr_branch"; fi if [ -n "$2" ]; then remote="$2"; else remote="origin"; fi echo "branch.$branch.remote: $remote" echo "branch.$branch.merge: refs/heads/$branch"