Skip to content

Commit 9e70a44

Browse files
committed
fix: delete failing when remote branch does not exist
1 parent 7b24f95 commit 9e70a44

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/commands/delete.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,24 @@ pub async fn delete_wip_branches_with_git(git: &impl Git, options: DeleteOptions
140140

141141
// Delete remote branch if requested
142142
if delete_remote {
143-
git.execute(vec![
144-
"push".to_string(),
145-
"origin".to_string(),
146-
"--delete".to_string(),
147-
branch.clone(),
148-
])
149-
.await
150-
.context(format!("Failed to delete remote branch '{}'", branch))?;
143+
match git
144+
.execute(vec![
145+
"push".to_string(),
146+
"origin".to_string(),
147+
"--delete".to_string(),
148+
branch.clone(),
149+
])
150+
.await
151+
{
152+
Ok(_) => {}
153+
Err(e) => {
154+
// Log the error but continue execution
155+
eprintln!(
156+
"Warning: Failed to delete remote branch '{}' (it may not exist): {}",
157+
branch, e
158+
);
159+
}
160+
}
151161
}
152162

153163
println!(

0 commit comments

Comments
 (0)