Usually, when I send Pull Requests on github, I would create a branch, make my changes, then ask them to merge that branch into their repo.
Once that is done, on Github, I delete the branch (but github just hides it). I then permanently delete the branch on the Github site.
Now that the remote branch is gone, how I can synchronize my local repo with the remote? I have tried fetching and pulling, but that does not delete the branches in my local repo.
Will I have to manually delete them from my repo, or is there some way to sync it?
You can try a:
git remote prune origin
(assuming the remote 'origin' references your GitHub repo)
This is explained in "cleaning up old remote git branches" (git branch -d localbranch
)
I don't know of a native git command which would do both.
Only a script like "git_remote_branch
" would delete a branch both on GitHub and locally
delete (aliases: destroy, kill, remove, rm)
Delete the remote branch then delete the local branch.
The local branch is not deleted if there are pending changes.
$ grb delete branch_name [origin_server]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With