dubswayAgenticV2 / clean-repo-history.bat
peace2024's picture
saving changes
7e867e7
raw
history blame
2.03 kB
@echo off
echo 🧹 Deep cleaning repository history...
echo.
echo ⚠️ WARNING: This will rewrite git history!
echo This will remove all binary files from the entire git history.
echo.
set /p confirm="Are you sure you want to continue? (y/N): "
if /i not "%confirm%"=="y" (
echo Cancelled.
pause
exit /b 0
)
echo.
echo πŸ—‘οΈ Removing binary files from git history...
REM Remove vector store directory from entire history
git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch vector_store/" --prune-empty --tag-name-filter cat -- --all
REM Remove database files from entire history
git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch *.db" --prune-empty --tag-name-filter cat -- --all
git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch *.sqlite" --prune-empty --tag-name-filter cat -- --all
git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch *.sqlite3" --prune-empty --tag-name-filter cat -- --all
REM Remove FAISS files from entire history
git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch *.faiss" --prune-empty --tag-name-filter cat -- --all
git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch *.index" --prune-empty --tag-name-filter cat -- --all
REM Remove log files from entire history
git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch *.log" --prune-empty --tag-name-filter cat -- --all
echo.
echo 🧹 Cleaning up...
git for-each-ref --format="delete %(refname)" refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now --aggressive
echo.
echo βœ… Repository history cleaned!
echo.
echo πŸ“ Now commit the current state...
git add .
git commit -m "Clean repository for Hugging Face deployment"
echo.
echo πŸš€ Ready to push! Run:
echo git push --force space develop
echo.
echo Or create a new branch:
echo git checkout -b main
echo git push space main
echo.
pause