cd /D "%~dp0." set "git=%~dp0PortableGit/bin/git.exe" set "remoteRepo=https://HiNC-Public-Client:HiNCProduct20241117@superhightech-gitea.webredirect.org/HiNC-Deploy/HiNC-Win-Product.git" "%git%" clone "%remoteRepo%" HiNC cd HiNC "%git%" remote set-url origin "%remoteRepo%" rem Keep local appsettings.json; align all other content to remote set "APP_FILE=appsettings.json" set "APP_BAK=%~dp0appsettings.json.bak" echo Backing up %APP_FILE% to %APP_BAK% (if exists)... if exist "%APP_FILE%" copy /Y "%APP_FILE%" "%APP_BAK%" echo Clearing index flags for %APP_FILE% (no-assume-unchanged / no-skip-worktree)... "%git%" update-index --no-assume-unchanged --no-skip-worktree -- "%APP_FILE%" echo Removing local %APP_FILE% to avoid 'not uptodate' conflicts... attrib -R "%APP_FILE%" >nul 2>&1 del /f /q "%APP_FILE%" >nul 2>&1 echo Fetching latest changes from origin... "%git%" fetch --all echo Resetting working tree to origin/master... "%git%" reset --hard origin/master echo Cleaning untracked files and directories... "%git%" clean -fd echo Restoring %APP_FILE% from backup (if exists)... if exist "%APP_BAK%" copy /Y "%APP_BAK%" "%APP_FILE%" echo Done. cd ..