mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-13 15:37:55 +00:00
cli: add a jj branch --forget
for forgetting everything about a branch
This commit is contained in:
parent
0711757324
commit
d121cd7f75
1 changed files with 20 additions and 1 deletions
|
@ -1106,7 +1106,22 @@ A A",
|
|||
.arg(
|
||||
Arg::with_name("delete")
|
||||
.long("delete")
|
||||
.help("Delete the branch"),
|
||||
.help("Delete the branch locally")
|
||||
.long_help(
|
||||
"Delete the branch locally. The deletion will be propagated to remotes on \
|
||||
push.",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("forget")
|
||||
.long("forget")
|
||||
.help("Forget the branch")
|
||||
.long_help(
|
||||
"Forget everything about the branch. There will be no record of its position \
|
||||
on remotes (no branchname@remotename in log output). Pushing will not affect \
|
||||
the branch on the remote. Pulling will bring the branch back if it still \
|
||||
exists on the remote.",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("name")
|
||||
|
@ -2682,6 +2697,10 @@ fn cmd_branch(
|
|||
let mut tx = repo_command.start_transaction(&format!("delete branch {}", branch_name));
|
||||
tx.mut_repo().remove_local_branch(branch_name);
|
||||
repo_command.finish_transaction(ui, tx)?;
|
||||
} else if sub_matches.is_present("forget") {
|
||||
let mut tx = repo_command.start_transaction(&format!("forget branch {}", branch_name));
|
||||
tx.mut_repo().remove_branch(branch_name);
|
||||
repo_command.finish_transaction(ui, tx)?;
|
||||
} else {
|
||||
let target_commit = repo_command.resolve_revision_arg(ui, sub_matches)?;
|
||||
if !sub_matches.is_present("allow-backwards")
|
||||
|
|
Loading…
Reference in a new issue