[Git] 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.

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

Also we can always using 

git reflog

To restore any deleted branch

原文地址:https://www.cnblogs.com/Answer1215/p/12187673.html