@@ -88,10 +88,6 @@ void checkoutNewBranch(@Parameters(index = "0", paramLabel = "<new_branch_name>"
88
88
}
89
89
}
90
90
91
- private static Stream <String > streamOf (String [] input ) {
92
- return Stream .of (input ).map (String ::trim ).distinct ();
93
- }
94
-
95
91
@ Command (name = "remove-branch" , aliases = "rm" )
96
92
void removeBranch (@ Parameters (index = "0" , paramLabel = "<branch name>" ) String branch ) {
97
93
if (isConfirmed ("Are you sure you want to remove branch '%s' ? [Y/n]" .formatted (branch ))) {
@@ -101,17 +97,24 @@ void removeBranch(@Parameters(index = "0", paramLabel = "<branch name>") String
101
97
102
98
@ Command (name = "push" , aliases = "pus" )
103
99
void push (@ Parameters (index = "0" , paramLabel = "<branch name>" ) String branch ,
100
+ @ Option (names = "-f" , description = "force to update remote origin branch" ) boolean force ,
104
101
@ Option (names = "-r" , description = "push to remote origin branch" ) boolean newRemoteBranch ) {
105
102
106
103
if (!isConfirmed ("Are you sure you want to push to remote '%s' [Y/n]" .formatted (branch ))) {
107
104
return ;
108
105
}
109
- var args = newRemoteBranch ? new String [] { "push" , "-u" , "origin" , branch } : new String [] { "push" };
106
+ var args = newRemoteBranch
107
+ ? new String [] { "push" , "-u" , "origin" , branch }
108
+ : force ? new String [] { "push" , "-f" } : new String [] { "push" };
110
109
forEachModuleWith (
111
110
path -> isSameBranchUnderPath (branch , path ),
112
111
path -> deployVertx (path , args ));
113
112
}
114
113
114
+ private static Stream <String > streamOf (String [] input ) {
115
+ return Stream .of (input ).map (String ::trim ).distinct ();
116
+ }
117
+
115
118
private boolean isSameBranchUnderPath (String branch , Path path ) {
116
119
try {
117
120
var proc = new ProcessBuilder (GisConfig .GIT_HOME_DIR , "branch" , "--show-current" )
0 commit comments