a guest Jun 18th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Cleaning up GIT after a successful PR merge
  3. ## Deleting from github
  4. * Navigate to the closed PR
  5. * Scroll down to the bottom of the PR page until you see "Pull request successfully merged and closed"
  6. * Click on "Delete branch"
  8. ## Cleaning local git environment
  9. Make sure to check out the development branch and retrieve changes from remote first:
  10. ```
  11. git checkout development
  12. git pull
  13. ```
  15. Then proceed to remove local and remote branch references from your local environment.
  16. Start by removing any local branches that have been deleted after a merge:
  17. ```
  18. git branch --merged | egrep -v "(^\*|master|dev|development)" | xargs git branch -d
  19. ```
  20. Then perform a dry-run of git-prune to ensure that the only references being removed are of remote branches that have been deleted after a merge:
  21. ```
  22. git remote prune origin --dry-run
  23. ```
  24. If all the branches listed are safe to be removed, perform the command above without any flags:
  25. ```
  26. git remote prune origin
  27. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand