DEV Community

Cover image for Recovering intentionally destroyed open-source repositories
Lars Gyrup Brink Nielsen for The Transient Thoughts of a Restless Mind

Posted on • Edited on

11 4

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 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
Enter fullscreen mode Exit fullscreen mode

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

Jetbrains image

Is Your CI/CD Server a Prime Target for Attack?

57% of organizations have suffered from a security incident related to DevOps toolchain exposures. It makes sense—CI/CD servers have access to source code, a highly valuable asset. Is yours secure? Check out nine practical tips to protect your CI/CD.

Learn more

Top comments (0)

Sentry image

Make it make sense

Make sense of fixing your code with straight-forward application monitoring.

Start debugging →

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay