How to recover deleted branches #23958
-
Is there any way to recover deleted branches, even restoing a repositiry as it was? Not clear how it happened but many braches were dekleted by a naive user. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Hi @jpffitch, Welcome to the Github Community Forum! I’m sorry to tell you, but I don’t really think so. All the commits, branches and tags are pointers to a specific memory address. As long as the pointer are alive (not deleted) you can retrive every events in history, but if these pointers are pull off from history the addresses can be use from other software. Obviously softwares overwrite the value of the addresses used. This is for local repository, but if you have this repository in github maybe there is a possiblity. I immagine that github have clusters of databases where the repository are stored, so it can be possible to retrive an old version of a repository from a low layer database and restore it. You could try to contact support and ask. Hope this helps, ask if you have more questions. -Gabriele- Mark helpfull posts with Accept as Solution to help other users locate important info. Don’t forget to give Kudos for great contents! |
Beta Was this translation helpful? Give feedback.
-
Thanks @wabri for giving your great explanation. @jpffitch We can’t restore the branches for you, but we can send you links that you can use to restore the branches on your end. If you can send us a link to the repository on GitHub we can check out logs and send those links over. If you haven’t already, please contact us at https://github.com/contact with the info so we can look into that further. This is something private support will need to assist you with. |
Beta Was this translation helpful? Give feedback.
-
It depends. Remember that git is a Distributed VCS, so, the security and integrity is a natural feature of this. So if someone delete a branch from the remote repository (GitHub), it’s possible that anyone have a copy on their local repository. In the other hand, if some delete the branch from their local repository, this person could restone the deleted branch from their local repository using the reflog command. |
Beta Was this translation helpful? Give feedback.
-
You can use Github Events API to identify the hash of push event and recreate the branch according to this answer on Stackoverflow.
|
Beta Was this translation helpful? Give feedback.
-
Hi, I would like to restore the content of a deleted remote repository. The repository is GitHub - brunolnetto/quindim: Hi, I am a robot! Beep beep boop . How can I have a list of deleted remote branches? How do I restore it, in case I can? Best regards, Bruno P. |
Beta Was this translation helpful? Give feedback.
Hi @jpffitch,
Welcome to the Github Community Forum!
I’m sorry to tell you, but I don’t really think so. All the commits, branches and tags are pointers to a specific memory address. As long as the pointer are alive (not deleted) you can retrive every events in history, but if these pointers are pull off from history the addresses can be use from other software. Obviously softwares overwrite the value of the addresses used.
This is for local repository, but if you have this repository in github maybe there is a possiblity. I immagine that github have clusters of databases where the repository are stored, so it can be possible to retrive an old version of a repository from a low layer data…