Skip to content

Commit 62ecb3f

Browse files
committed
Added support for -B branch switching on checkout via :force_branch option
1 parent 9d4b755 commit 62ecb3f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/git/lib.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,11 @@ def branch_delete(branch)
488488
def checkout(branch, opts = {})
489489
arr_opts = []
490490
arr_opts << '-f' if opts[:force]
491-
arr_opts << '-b' << opts[:new_branch] if opts[:new_branch]
491+
if( opts[:force_branch] )
492+
arr_opts << '-B' << opts[:force_branch]
493+
else
494+
arr_opts << '-b' << opts[:new_branch] if opts[:new_branch]
495+
end
492496
arr_opts << branch
493497

494498
command('checkout', arr_opts)

0 commit comments

Comments
 (0)