Susan Potter
### git

How do I delete a branch in Git locally and globally?

To delete a Git branch locally and then remotely, you can follow these steps:

  1. Delete the local branch using the git branch command with the -d option:

    git branch -d <branch_name>
    

    This will delete the local branch named <branch_name>. If the branch has unmerged changes, Git will not allow you to delete the branch. In that case, you can use the -D option instead of -d to force delete the branch.

  2. Delete the remote branch using the git push command with the --delete option:

    git push origin --delete <branch_name>
    

    This will delete the remote branch named <branch_name> on the origin remote.

Note: If you don’t want to delete the remote branch, you can skip step 2.

If you’re using a different remote name, replace origin with the name of your remote. Once you have deleted the branch locally and remotely, it will no longer be available in your Git repository.

Susan Potter

Susan Potter

Quant

Work with me

I spent the first half of my career building risk models and market data infrastructure at BNP Paribas, Bank of America, and Citadel, then fourteen years shipping production systems at scale. Now I bring both sides to quantitative trading. If you're a trading firm, family office, or fund looking to tighten the connection between your research ideas and your production trading systems, whether that's building validation pipelines, formalizing signal logic, or getting microstructure analytics into a deployable state, I'd like to hear what you're working on. Reach me at me@susanpotter.net.