Skip to content

Commit 82ac4da

Browse files
committed
feat: delete branch by default, retain with flag
Just a more useful workflow.
1 parent df3b16d commit 82ac4da

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main.rs

+10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ struct Args {
2727
/// When set, perform checks but do not actually change the repo state.
2828
#[arg(short, long)]
2929
dry_run: bool,
30+
31+
/// When set, retain the merged branch instead of deleting it locally.
32+
#[arg(short, long)]
33+
retain_branch: bool,
3034
}
3135

3236
fn ensure_tool(sh: &Shell, tool_name: &str) -> Result<()> {
@@ -203,5 +207,11 @@ fn main() -> Result<()> {
203207
.context("2nd attempt to push to base")?;
204208
}
205209

210+
if !args.retain_branch {
211+
cmd!(sh, "git branch -D {branch}")
212+
.run()
213+
.context("removing merged branch")?;
214+
}
215+
206216
Ok(())
207217
}

0 commit comments

Comments
 (0)