Recovering intentionally destroyed open-source repositories

It happens from time to time that disgruntled open-source maintainers destroy the very work they created.

Recently, the maintainer of two npm packages deleted all commits in their source repositories after announcing that the packages are frozen.

One…


This content originally appeared on DEV Community and was authored by Lars Gyrup Brink Nielsen

It happens from time to time that disgruntled open-source maintainers destroy the very work they created.

Recently, the maintainer of two npm packages deleted all commits in their source repositories after announcing that the packages are frozen.

One of the packages has more than 15,000 downloads on npm per month.

Sunsetting your maintainer role

What are good ways to deal with this situation?

  • Reach out for other people to become maintainers but make sure that your project is in good hands
  • Grant the new maintainers ownership of the package registry account your project releases to
  • If all else fails, mark the repository as archived

Deleting all or most commits, files, and branches prevents other from continuing the efforts that you are abandoning.

Options for recovering

If you come across a repository where this happened, look for your own local clone or community forks that are up-to-date with the upstream repository.

From a GitHub pull request, it is possible to navigate to the commit that was last merged even if it has been detached from all branches.

Once you have identified a commit you want to recover, create a new repository to recover to, then enter these commands:

git clone <broken-repo> # for example https://github.com/DisgruntledMaintainer/oss-repo.git
git checkout main
git fetch origin <commit-hash>
git reset --hard FETCH_HEAD
git remote add clone <clone-repo> # for example https://github.com/YourName/oss-repo.git
git push -u clone main

The packages in question have now found a new group of maintainers after I helped to recover the source code ❤️ May they all live happily ever after!


This content originally appeared on DEV Community and was authored by Lars Gyrup Brink Nielsen


Print Share Comment Cite Upload Translate Updates
APA

Lars Gyrup Brink Nielsen | Sciencx (2022-06-23T20:36:10+00:00) Recovering intentionally destroyed open-source repositories. Retrieved from https://www.scien.cx/2022/06/23/recovering-intentionally-destroyed-open-source-repositories/

MLA
" » Recovering intentionally destroyed open-source repositories." Lars Gyrup Brink Nielsen | Sciencx - Thursday June 23, 2022, https://www.scien.cx/2022/06/23/recovering-intentionally-destroyed-open-source-repositories/
HARVARD
Lars Gyrup Brink Nielsen | Sciencx Thursday June 23, 2022 » Recovering intentionally destroyed open-source repositories., viewed ,<https://www.scien.cx/2022/06/23/recovering-intentionally-destroyed-open-source-repositories/>
VANCOUVER
Lars Gyrup Brink Nielsen | Sciencx - » Recovering intentionally destroyed open-source repositories. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/06/23/recovering-intentionally-destroyed-open-source-repositories/
CHICAGO
" » Recovering intentionally destroyed open-source repositories." Lars Gyrup Brink Nielsen | Sciencx - Accessed . https://www.scien.cx/2022/06/23/recovering-intentionally-destroyed-open-source-repositories/
IEEE
" » Recovering intentionally destroyed open-source repositories." Lars Gyrup Brink Nielsen | Sciencx [Online]. Available: https://www.scien.cx/2022/06/23/recovering-intentionally-destroyed-open-source-repositories/. [Accessed: ]
rf:citation
» Recovering intentionally destroyed open-source repositories | Lars Gyrup Brink Nielsen | Sciencx | https://www.scien.cx/2022/06/23/recovering-intentionally-destroyed-open-source-repositories/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.