To unlink the git repo to GitHub,
entering git remote -v
will list the remotes configured.
origin git@github.com:user/repo.git (fetch)
origin git@github.com:user/repo.git (push)
gitlab git@gitlab.com:/user/repo.git (fetch)
gitlab git@gitlab.com:/user/repo.git (push)
the one with github.com (https://
or git@
) points to the remote to GitHub. (here origin
)
To remove a remote, you can,
git remote remove origin
or in older versions of git,
git remote rm origin
To add a new github repo as the remote, you can
git remote add <name> <repo url>
example. git remote add origin https://github.com/myusername/myproject.git
To reset the branch to the initial (or any specific) commit,
in the version control
> log
, scroll down to the initial (or any specific) commit

and click Reset Current Branch to Here...
then select hard

and press reset. (this is an irreversible change)
to push the changes in the local repo to the remote repo (after resetting to local to desired commit), run push with -f
which forcefully updates the remote. make sure the remote branch is not protected to push -f
.
git push -f <remote> <branch>
example. git push -f origin master
To delete all .git
stuff and startover, you may run
sudo rm -rf .git/
at the repo root (this will delete the .git directory, irreversible change) and then run git init