@@ -96,16 +96,18 @@ def show b, all_branches
9696 if $config[ "versions" ] . include? b [ :remote_branch ]
9797 puts "\n Feature branches:" unless fbs . empty?
9898 fbs . each do |name , br |
99- remote_ahead = commits_between b [ :remote_branch ] , br [ :local_branch ]
100- local_ahead = commits_between b [ :local_branch ] , br [ :local_branch ]
101- if local_ahead . empty? && remote_ahead . empty?
102- puts "[x] #{ br [ :name ] } is merged in"
103- elsif local_ahead . empty?
104- puts "(x) #{ br [ :name ] } merged in (only locally)"
105- else
106- behind = commits_between br [ :local_branch ] , b [ :remote_branch ]
107- puts "[ ] #{ br [ :name ] } is NOT merged in (#{ ahead_behind_string local_ahead , behind } )"
108- show_commits local_ahead , nil , " "
99+ if not `git merge-base #{ b [ :remote_branch ] } #{ br [ :local_branch ] } ` . split ( "\n " ) . empty?
100+ remote_ahead = commits_between b [ :remote_branch ] , br [ :local_branch ]
101+ local_ahead = commits_between b [ :local_branch ] , br [ :local_branch ]
102+ if local_ahead . empty? && remote_ahead . empty?
103+ puts "[x] #{ br [ :name ] } is merged in"
104+ elsif local_ahead . empty?
105+ puts "(x) #{ br [ :name ] } merged in (only locally)"
106+ else
107+ behind = commits_between br [ :local_branch ] , b [ :remote_branch ]
108+ puts "[ ] #{ br [ :name ] } is NOT merged in (#{ ahead_behind_string local_ahead , behind } )"
109+ show_commits local_ahead , nil , " "
110+ end
109111 end
110112 end
111113 else
0 commit comments