From 877f06944d37cc38a8542f7b1b65c5b1c028938d Mon Sep 17 00:00:00 2001 From: rkiel Date: Sat, 7 Oct 2017 10:20:33 -0400 Subject: [PATCH] 10-remotes: check for remote branch --- lib/shared/runnable.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/shared/runnable.rb b/lib/shared/runnable.rb index c14326a..af15bff 100644 --- a/lib/shared/runnable.rb +++ b/lib/shared/runnable.rb @@ -56,9 +56,15 @@ module Shared run_cmd "git merge origin/#{branch}" end + def is_remote_branch (branch) + `git branch -r|grep origin|grep -v 'HEAD'|grep #{branch}`.strip != "" + end + def git_fetch_and_merge (branch) git_fetch - git_remote_merge branch + if is_remote_branch(branch) + git_remote_merge branch + end end def git_remote_branch_delete ( branch )