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
More on Commits, branches and tags
How do you write a good commit message?BeginnerWhat is the difference between `git add .`, `git add -A` and `git add -u`?BeginnerHow do you commit only part of the changes in a file?BeginnerHow do you change the last commit message or add a forgotten file?BeginnerWhat is the difference between `git switch`, `git restore` and `git checkout`?BeginnerWhat is the difference between lightweight and annotated tags?Beginner