knznsmn

Resetting A Repository

toolsunix

Existing git repository

If if (!repository), clone it:

git clone <remote repository>
cd <repository>

To check the remote url of the repo:

git remote -v

Resetting git repo

Remove all git history:

rm -rf .git

Reinitialize git:

git init

Reconnect Repo to GitHub

Get and copy the repo's url:

git remote add origin <remote-repository-url>

There should be at least one file to commit.

git commit -m "Reset repository"

Force push to GitHub

git push --force origin main

Replace main withh the branch name if it's different.