I created a repository on Github. I have two development environments, and I access Github with Github for Windows on both.
On one of the two development environments, I deleted a branch and clicked "synchronize" in Github for Windows. The branch appropriately got deleted in Github. When I synchronized from my other development environment, there was an option to "publish" the branch-to-be-deleted, but none to delete it.
How can I tell git or Github for Windows to make a full sync, including the deletion of obsolete branches?
Yes and no — depending on what you really meant by "deletion of a local branch".
No, it's impossible to have a remote repository delete a normal branch in your local repository.
Yes, it's possible to ask Git delete remote branches in your local repository for the branches which were deleted on a particular named remote (such as "origin").
This one is achieved by running
git remote prune origin
or
git fetch --prune
Please do understand first that Git's model with working with remote repositories is asymmetric: the fact a branch in your local repository has the name exactly matching that of a branch in a remote repository has no meaning to Git.
The reason is two-fold:
So while Git has certain helpers to somewhat tie local branches to particular remote branches, these ties are asymmetric. In particular, Git treats your local history as being "sacred", and destructive operations on it require your explicit actions.
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