If you want to delete all git commit history but keep the files, you can follow the steps bellow.

IMPORTANT: Please DO NOT delete the .git folder directly, as this will cause issues with your git repository.

1. Create an Orphan Branch

git checkout --orphan new_branch

Create an orphan branch (a branch without a parent branch), named new_branch, and switch to it.

--orphan: Create an orphan branch from starting from the current HEAD. The first commit made on this new branch will establish a new history that is entirely disconnected from all other branches and commits.

2. Add Alll Files to the New Brach

git add -A
git commit -am "initial commint"

3. Delete the Main Branch

git branch -D main

Replace “main” with your actual branch name if it differs.

4. Rename New Branch to Main

git branch -m main

5. Push to Remote Branch

git push -f origin main

-f: is an abbreviation for --force, which forces overwriting the remote branch during the push operation.

Caution: The above operations will permanently erase the git commit history.