Interview Prep/Git & GitHub/Commits, branches and tags

How do you delete a branch locally and remotely, and what does `-d` versus `-D` mean?

IntermediateConceptCommits, branches and tags
Answer

-d refuses to delete a branch that has unmerged commits, -D forces it. Remote deletion is a push of an empty source. After that, other clones must prune stale tracking refs.

git branch -d feature/x
git push origin --delete feature/x
git fetch --prune     # or: git config fetch.prune true
All Git & GitHub questions Roadmap: Git & GitHub

More on Commits, branches and tags