From 3f5782dea04681fa9dc7a2a70c870035d940a3a1 Mon Sep 17 00:00:00 2001 From: Alessandro Seravalli Date: Wed, 7 May 2025 10:53:30 +0200 Subject: [PATCH] switch_git.bat --- fid_git.zip => fid-git.zip | Bin switch_git.bat | 99 +++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) rename fid_git.zip => fid-git.zip (100%) create mode 100644 switch_git.bat diff --git a/fid_git.zip b/fid-git.zip similarity index 100% rename from fid_git.zip rename to fid-git.zip diff --git a/switch_git.bat b/switch_git.bat new file mode 100644 index 0000000..de80cc3 --- /dev/null +++ b/switch_git.bat @@ -0,0 +1,99 @@ +@echo off +setlocal enabledelayedexpansion + +REM Script to switch between Fideuram (fid) and Armundia (arm) Git environments +REM This script compresses the current .git folder and extracts the other one + +echo Switching Git environment... + +REM Check if .git folder exists +if exist ".git" ( + REM Determine which environment to switch to + if exist "fid-git.zip" ( + REM Current environment is Armundia, switch to Fideuram + echo Current environment: Armundia + echo Switching to Fideuram environment... + + REM Compress Armundia .git folder + echo Compressing Armundia .git folder... + powershell -command "Compress-Archive -Path '.git' -DestinationPath 'arm-git.zip' -Force" + + REM Remove current .git folder + echo Removing current .git folder... + rmdir /s /q .git + + REM Extract Fideuram .git folder + echo Extracting Fideuram .git folder... + powershell -command "Expand-Archive -Path 'fid-git.zip' -DestinationPath '.' -Force" + + REM Delete the zip file after extraction + echo Removing the Fideuram zip file... + del /f /q fid-git.zip + + echo Successfully switched to Fideuram environment. + ) else if exist "arm-git.zip" ( + REM Current environment is Fideuram, switch to Armundia + echo Current environment: Fideuram + echo Switching to Armundia environment... + + REM Compress Fideuram .git folder + echo Compressing Fideuram .git folder... + powershell -command "Compress-Archive -Path '.git' -DestinationPath 'fid-git.zip' -Force" + + REM Remove current .git folder + echo Removing current .git folder... + rmdir /s /q .git + + REM Extract Armundia .git folder + echo Extracting Armundia .git folder... + powershell -command "Expand-Archive -Path 'arm-git.zip' -DestinationPath '.' -Force" + + REM Delete the zip file after extraction + echo Removing the Armundia zip file... + del /f /q arm-git.zip + + echo Successfully switched to Armundia environment. + ) else ( + REM First run - no compressed Git folders exist yet + echo This appears to be the first run. + echo Current .git folder will be considered as Fideuram environment. + + REM Compress current .git as Fideuram + echo Compressing current .git folder as Fideuram... + powershell -command "Compress-Archive -Path '.git' -DestinationPath 'fid-git.zip' -Force" + + echo Please initialize the Armundia Git repository and run this script again. + echo You can initialize a new Git repository with: git init + ) +) else ( + REM No .git folder exists + if exist "fid-git.zip" ( + REM Extract Fideuram .git folder + echo No .git folder found. Extracting Fideuram environment... + powershell -command "Expand-Archive -Path 'fid-git.zip' -DestinationPath '.' -Force" + + REM Delete the zip file after extraction + echo Removing the Fideuram zip file... + del /f /q fid-git.zip + + echo Successfully switched to Fideuram environment. + ) else if exist "arm-git.zip" ( + REM Extract Armundia .git folder + echo No .git folder found. Extracting Armundia environment... + powershell -command "Expand-Archive -Path 'arm-git.zip' -DestinationPath '.' -Force" + + REM Delete the zip file after extraction + echo Removing the Armundia zip file... + del /f /q arm-git.zip + + echo Successfully switched to Armundia environment. + ) else ( + REM No Git environments found + echo No Git environments found. + echo Please initialize a Git repository with: git init + ) +) + +echo. +echo Done! +pause \ No newline at end of file