Skip to main content

Reset Repo Commits

Linux

export GIT_RESET_USER=yourUserNameOrOrgName
export GIT_RESET_REPO=yourRepoName
rm -rf .git
git init
git add .
git checkout -b main
git commit -m "Initial Commit"
git remote add origin [email protected]:$GIT_RESET_USER/$GIT_RESET_REPO.git
git remote set-url origin https://github.com/$GIT_RESET_USER/$GIT_RESET_REPO.git
git push -u --force origin main

Windows

set GIT_RESET_USER=yourUserNameOrOrgName
set GIT_RESET_REPO=yourRepoName
rd /s /q .git
git init
git add .
git checkout -b main
git commit -m "Initial Commit"
git remote add origin [email protected]:%GIT_RESET_USER%/%GIT_RESET_REPO%.git
git remote set-url origin https://github.com/%GIT_RESET_USER%/%GIT_RESET_REPO%.git
git push -u --force origin main