top of page
INTERMEDIATE LEVEL
Q18: How do you delete a branch in Git?
To delete a branch in Git, you can use the command
`git branch -d <branch-name>`.
This deletes the specified branch locally.
If the branch has not been merged, you can use
`git branch -D <branch-name>`
to force delete it.
To delete a remote branch, you can use `git push origin --delete <branch-name>`.
bottom of page