Course lesson

Cleanup and Delete Branches After a Pull Request

We've made a pull request and now we can clean up the branches by deleting the feature branch.

Duration
2 min
Access
Free
Transcript
Retained from source evidence

We've made a pull request and now we can clean up the branches by deleting the feature branch.

Branches are just pointers to commits - so we can safely delete branches without losing the underlying commits (once the commits are merged back into master).

So we'll use the github interface to delete the branch remotely, and to delete it locally we'll use git remote prune origin --dry-run and then git remote prune origin

That will tell us that the remote is gone, and we can finally clean up the feature branch with: git branch -d feature-branch

Terminal
# use the github interface to delete the branch remotely

# Locally
# Confirm that remote is gone
git remote prune origin --dry-run
git remote prune origin

#clean up the feature branch
git branch -d feature-branch

✏️ Edit on GitHub