File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -41,19 +41,35 @@ export class Git {
4141 ] ) ;
4242 }
4343
44+ /**
45+ * Checkout a new branch and set upstream
46+ */
47+ async createBranch ( branch : string ) {
48+ await this . commands . run ( [
49+ "git checkout -b " + branch ,
50+ "git push --set-upstream origin " + branch ,
51+ ] ) ;
52+ }
53+
4454 /**
4555 * Checkout a branch
4656 */
47- async checkout ( branch : string , isNewBranch = false ) {
57+ async checkout (
58+ ref : string ,
59+ /**
60+ * @deprecated Use createBranch instead
61+ */
62+ isNewBranch = false
63+ ) {
4864 if ( isNewBranch ) {
4965 await this . commands . run ( [
50- "git checkout -b " + branch ,
51- "git push --set-upstream origin " + branch ,
66+ "git checkout -b " + ref ,
67+ "git push --set-upstream origin " + ref ,
5268 ] ) ;
5369 return ;
5470 }
5571
56- await this . commands . run ( [ "git checkout " + branch ] ) ;
72+ await this . commands . run ( [ "git checkout " + ref ] ) ;
5773 }
5874
5975 /**
You can’t perform that action at this time.
0 commit comments