File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -511,8 +511,21 @@ def branch_delete(branch)
511
511
def checkout ( branch , opts = { } )
512
512
arr_opts = [ ]
513
513
arr_opts << '-f' if opts [ :force ]
514
- arr_opts << '-b' << opts [ :new_branch ] if opts [ :new_branch ]
514
+
515
+ # -- implementation of a working -b switch
516
+ # for git checkout command
517
+ arr_opts << '-b' if opts [ :new_branch ]
518
+ # -- this push is legacy
519
+ # i don't understand it and congratulate
520
+ # myself not to try to and just leave it here
521
+ arr_opts << opts [ :new_branch ] if opts [ :new_branch ] && !opts [ :new_branch ] . is_a? ( TrueClass )
522
+ #
523
+
515
524
arr_opts << branch
525
+
526
+ # -- we can 'git checkout `sha`' now
527
+ arr_opts << opts [ :commit ] if opts [ :commit ]
528
+ #
516
529
517
530
command ( 'checkout' , arr_opts )
518
531
end
You can’t perform that action at this time.
0 commit comments