From f51e3ba2968a45013c0adc74dbdacdd1f15915b2 Mon Sep 17 00:00:00 2001 From: Benjamin Labrecque Date: Mon, 6 Jul 2026 12:22:03 +0200 Subject: [PATCH] chore: delete local feature branch before checking it out --- cli/src/core/git.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cli/src/core/git.py b/cli/src/core/git.py index 17638b2..8ca7b40 100644 --- a/cli/src/core/git.py +++ b/cli/src/core/git.py @@ -38,6 +38,14 @@ def git_push_changes( logger.info(f"Git Operation Failed: {e}") +def delete_local_branch(repo: git.Repo, branch_name: str): + """ + Delete local branch if it already exists + """ + logger.info(f"Deleting local branch '{branch_name}'...") + repo.git.branch("-D", branch_name) + + def switch_branch(repo: git.Repo, branch_name: str): """ Create branch if it doesn't exist, then checkout