For remote branches that have been removed via git prune --all origin
, how do you restore them?
There are over 100 branches and shared by a team of 20 people and everyone is working on different sets of branches.
The prune option removes any remote tracking branch in your local repository that points to a remote branch that has been deleted on the server. With the local branch deleted, the remote tracking branch deleted, and all instances of the remote git branch deleted as well, the remote Git branch should be gone forever.
In summary when enabling the prune on every fetch, this means your local list of branches is always up-to-date with the remote. Pruning will cleanup and remove your local tracking branches that no longer exist on the server.
Pushing all branches back again seems the easiest solution (as in "Set up git to pull and push all branches")
(unless you find those branches still referenced in the reflog of the server)
Then you can make sure your local repo is tracking them again, with that one-liner in "Track all remote git branches as local branches".
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