@@ -44,6 +44,23 @@ export const forcePush: BranchSequencerBase = (argsBase) =>
44
44
const branch : Git . Reference = await repo . getCurrentBranch ( ) ;
45
45
const upstreamBranch : Git . Reference | null = await Git . Branch . upstream ( branch ) . catch ( ( ) => null ) ;
46
46
47
+ /**
48
+ * TODO work out a good solution because we don't want the user
49
+ * to get interrupted while in-between the "push" flow,
50
+ * or at least handle it ourselves / ask the user how to continue
51
+ *
52
+ * maybe need to have a `--push --continue`?
53
+ * ugh, starts to get mixed up w/ other commands, idk!
54
+ * or could `--continue` be used in any circumstance,
55
+ * i.e. both in a rebase setting, and in a push setting?
56
+ *
57
+ * could maybe utilize --dry-run? or analyze ourselves? idk
58
+ *
59
+ * needs to be further explored with our `--sync` (TBD)
60
+ *
61
+ */
62
+ const forceWithLeaseOrForce : string = "--force-with-lease" ;
63
+
47
64
if ( ! upstreamBranch ) {
48
65
const remotes : string [ ] = await repo . getRemoteNames ( ) ;
49
66
@@ -85,11 +102,11 @@ export const forcePush: BranchSequencerBase = (argsBase) =>
85
102
remote = answer ;
86
103
}
87
104
88
- const cmd = `push -u ${ remote } ${ branch . name ( ) } --force ` ;
105
+ const cmd = `push -u ${ remote } ${ branch . name ( ) } ${ forceWithLeaseOrForce } ` ;
89
106
console . log ( `running ${ cmd } ` ) ;
90
107
execSyncInRepo ( `${ argsBase . gitCmd } ${ cmd } ` ) ;
91
108
} else {
92
- execSyncInRepo ( `${ argsBase . gitCmd } push --force ` ) ;
109
+ execSyncInRepo ( `${ argsBase . gitCmd } push ${ forceWithLeaseOrForce } ` ) ;
93
110
}
94
111
} ,
95
112
delayMsBetweenCheckouts : 0 ,
0 commit comments