Fixing a shallow GIT repo

GIT Commits & History
Photo by Yancy Min on Unsplash

Sometimes, a developer might intentionally (or) unintentionally end up with a shallow GIT Repo. And this can be a pain for those who unintentionally end up with shallow Repo.

You need to unshallow your local Repo. Following these simple steps can help you out of this situation.

Step 1: You must update/fix your origin remote repo.
git remote add origin <path-to-old-remote>

Step 2: You would need to perform a git fetch with an unlike option (as suggested below)
git fetch — unshallow origin

Just these two steps would restore your repo to the normal state. After this, you can perform all options, like push into your new remote repository.

Initially, this was posted as a GIST @ https://gist.github.com/gobinathm/96e27a588bb447154604963e09c38ddc

--

--

Gobinath Mallaiyan
Programmers Notebook

அப்பா, கணவன், Architect, Technical Manager, Mentor, Coach 🏃 👨‍💻 📷 🏋🏼