Skip to content

Commit 4d9456a

Browse files
committed
check branch exists
1 parent 86f0493 commit 4d9456a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

check_branch_exist.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require 'rugged'
2+
3+
repo = Rugged::Repository.new('.')
4+
5+
branches = repo.branches
6+
7+
p branches.exist?('hoge') #=> false
8+
p branches.exist?('master') #=> true
9+
10+
p branches.exists?('hoge') #=> false
11+
p branches.exists?('master') #=> true

0 commit comments

Comments
 (0)