Skip to main content

Reset Repo Commits

Linux

export GIT_RESET_USER=yourUserNameOrOrgName
export GIT_RESET_REPO=yourRepoName
export GIT_HOST=https://git.chse.dev
rm -rf .git
git init
git add .
git checkout -b main
git commit -m "Initial Commit"
git remote add origin $GIT_HOST/$GIT_RESET_USER/$GIT_RESET_REPO.git
git remote set-url origin $GIT_HOST/$GIT_RESET_USER/$GIT_RESET_REPO.git
git push -u --force origin main

Windows

set GIT_RESET_USER=yourUserNameOrOrgName
set GIT_RESET_REPO=yourRepoName
set GIT_HOST=https://git.chse.dev
rd /s /q .git
git init
git add .
git checkout -b main
git commit -m "Initial Commit"
git remote add origin %GIT_HOST%/%GIT_RESET_USER%/%GIT_RESET_REPO%.git
git remote set-url origin %GIT_HOST%/%GIT_RESET_USER%/%GIT_RESET_REPO%.git
git push -u --force origin main