Deleting a branch after a pull request is merged

Assuming we are working with a remote tracking branch called testing

git branch -a
* master
  testing
  remotes/origin/master
  remotes/origin/testing
  • Assuming branch was deleted on remote repo (ex: via GitHub)
git fetch --prune

this will delete any remote branch that does not exist on the remote repo. —prune is needed since fetch won’t remove branches missing remote counterpart by default

  • Assuming change is made locally
git branch -r

will show list of branches that exist on remote these can be deleted with git push —delete: git push origin --delete testing