@@ -31,8 +31,16 @@ function deleteContribution(branchName)
31
31
reply = input([gitCmd .lead , originCall , ' Are you sure that you want to delete the feature (branch) <' , branchName , ' >? YES/NO [NO]: ' ], ' s' );
32
32
33
33
if strcmpi(reply , ' yes' ) % users MUST enter 'yes', not only 'y'
34
- % checkout the develop branch
35
- checkoutBranch(' develop' );
34
+
35
+ % check if the develop branch exists remotely
36
+ if checkRemoteBranchExistence(' develop' )
37
+ mainBranch = ' develop' ;
38
+ else
39
+ mainBranch = ' master' ; % fall back to master, which always exists
40
+ end
41
+
42
+ % checkout the develop branch
43
+ checkoutBranch(mainBranch );
36
44
37
45
% retrieve a list of all the branches
38
46
if ispc
@@ -65,11 +73,8 @@ function deleteContribution(branchName)
65
73
error([gitCmd .lead , ' [' , mfilename ,' ] The list of features (branches) could not be retrieved.' , gitCmd .fail ]);
66
74
end
67
75
68
- % check if branch exists remotely
69
- [status_curl , result_curl ] = system([' curl -s -k --head ' , gitConf .remoteServerName , gitConf .userName , ' /' , gitConf .remoteRepoName , ' /tree/' , branchName ]);
70
-
71
76
% delete the remote branch
72
- if status_curl == 0 && ~isempty(strfind( result_curl , ' 200 OK ' ) )
77
+ if checkRemoteBranchExistence( branchName )
73
78
74
79
[status_gitPush , result_gitPush ] = system([' git push origin --delete ' , branchName ]);
75
80
0 commit comments