diff --git a/SimpleGit-Provider.lvproj b/SimpleGit-Provider.lvproj
index 372e002..b0e80da 100644
--- a/SimpleGit-Provider.lvproj
+++ b/SimpleGit-Provider.lvproj
@@ -26,6 +26,8 @@
true
-
+ 3
+
@@ -34,7 +36,7 @@
-
+
diff --git a/SimpleGit/Git/Command/SimpleGit-Commit.vi b/SimpleGit/Git/Command/SimpleGit-Commit.vi
index d226208..6bb2d6d 100644
Binary files a/SimpleGit/Git/Command/SimpleGit-Commit.vi and b/SimpleGit/Git/Command/SimpleGit-Commit.vi differ
diff --git a/SimpleGit/Git/Command/SimpleGit-LeaveDailyBranch.vi b/SimpleGit/Git/Command/SimpleGit-LeaveDailyBranch.vi
index d9a4410..3ad1193 100644
Binary files a/SimpleGit/Git/Command/SimpleGit-LeaveDailyBranch.vi and b/SimpleGit/Git/Command/SimpleGit-LeaveDailyBranch.vi differ
diff --git a/SimpleGit/Git/Command/SimpleGit-Pull.vi b/SimpleGit/Git/Command/SimpleGit-Pull.vi
index 40b6e8b..b4424ed 100644
Binary files a/SimpleGit/Git/Command/SimpleGit-Pull.vi and b/SimpleGit/Git/Command/SimpleGit-Pull.vi differ
diff --git a/SimpleGit/Git/Command/SimpleGit-Push.vi b/SimpleGit/Git/Command/SimpleGit-Push.vi
index f3be1ec..8e46be6 100644
Binary files a/SimpleGit/Git/Command/SimpleGit-Push.vi and b/SimpleGit/Git/Command/SimpleGit-Push.vi differ
diff --git a/SimpleGit/Git/Command/SimpleGit-Settings.vi b/SimpleGit/Git/Command/SimpleGit-Settings.vi
index 4282188..f3e0e0e 100644
Binary files a/SimpleGit/Git/Command/SimpleGit-Settings.vi and b/SimpleGit/Git/Command/SimpleGit-Settings.vi differ
diff --git a/SimpleGit/Git/Command/SimpleGit-Status.vi b/SimpleGit/Git/Command/SimpleGit-Status.vi
index 174902c..ccb18a6 100644
Binary files a/SimpleGit/Git/Command/SimpleGit-Status.vi and b/SimpleGit/Git/Command/SimpleGit-Status.vi differ
diff --git a/SimpleGit/Git/Command/SimpleGit-SwitchToDailyBranch.vi b/SimpleGit/Git/Command/SimpleGit-SwitchToDailyBranch.vi
index 64adc91..bf18e5d 100644
Binary files a/SimpleGit/Git/Command/SimpleGit-SwitchToDailyBranch.vi and b/SimpleGit/Git/Command/SimpleGit-SwitchToDailyBranch.vi differ
diff --git a/SimpleGit/Git/SimpleGit_Item_OnCommand.vi b/SimpleGit/Git/SimpleGit_Item_OnCommand.vi
index a6fabf6..64a2449 100644
Binary files a/SimpleGit/Git/SimpleGit_Item_OnCommand.vi and b/SimpleGit/Git/SimpleGit_Item_OnCommand.vi differ
diff --git a/SimpleGit/Git/SimpleGit_Item_OnUpdateCommand.vi b/SimpleGit/Git/SimpleGit_Item_OnUpdateCommand.vi
index 1db204e..06fc643 100644
Binary files a/SimpleGit/Git/SimpleGit_Item_OnUpdateCommand.vi and b/SimpleGit/Git/SimpleGit_Item_OnUpdateCommand.vi differ
diff --git a/SimpleGit/Git/SimpleGit_Menu_Hierachy.vi b/SimpleGit/Git/SimpleGit_Menu_Hierachy.vi
index 9a6e145..09f84ad 100644
Binary files a/SimpleGit/Git/SimpleGit_Menu_Hierachy.vi and b/SimpleGit/Git/SimpleGit_Menu_Hierachy.vi differ
diff --git a/SimpleGit/Git/_Support/GIT-Current Local Branches.vi b/SimpleGit/Git/_Support/GIT-Current Local Branches.vi
index 0a94f48..2431116 100644
Binary files a/SimpleGit/Git/_Support/GIT-Current Local Branches.vi and b/SimpleGit/Git/_Support/GIT-Current Local Branches.vi differ
diff --git a/SimpleGit/Git/_Support/Git Check whether Branch exists.vi b/SimpleGit/Git/_Support/Git Check whether Branch exists.vi
index 046e907..dbeb9e0 100644
Binary files a/SimpleGit/Git/_Support/Git Check whether Branch exists.vi and b/SimpleGit/Git/_Support/Git Check whether Branch exists.vi differ
diff --git a/SimpleGit/Git/_Support/SimpleGit Setting Dialog.vi b/SimpleGit/Git/_Support/SimpleGit Setting Dialog.vi
index e4a05bf..b1585f1 100644
Binary files a/SimpleGit/Git/_Support/SimpleGit Setting Dialog.vi and b/SimpleGit/Git/_Support/SimpleGit Setting Dialog.vi differ
diff --git a/SimpleGit/Git/_Support/config/simplegit.DailyBranchPrefix.vi b/SimpleGit/Git/_Support/config/simplegit.DailyBranchPrefix.vi
index a3998ca..bd9142a 100644
Binary files a/SimpleGit/Git/_Support/config/simplegit.DailyBranchPrefix.vi and b/SimpleGit/Git/_Support/config/simplegit.DailyBranchPrefix.vi differ
diff --git a/SimpleGit/Git/_Support/lvgit commit.vi b/SimpleGit/Git/_Support/lvgit commit.vi
index 9b26381..949b4d7 100644
Binary files a/SimpleGit/Git/_Support/lvgit commit.vi and b/SimpleGit/Git/_Support/lvgit commit.vi differ
diff --git a/SimpleGit/Git/_Support/lvgit pull.vi b/SimpleGit/Git/_Support/lvgit pull.vi
index 6c1e058..a8fe7df 100644
Binary files a/SimpleGit/Git/_Support/lvgit pull.vi and b/SimpleGit/Git/_Support/lvgit pull.vi differ
diff --git a/SimpleGit/Git/_Support/lvgit push.vi b/SimpleGit/Git/_Support/lvgit push.vi
index 7e1a1c2..3596bf7 100644
Binary files a/SimpleGit/Git/_Support/lvgit push.vi and b/SimpleGit/Git/_Support/lvgit push.vi differ
diff --git a/SimpleGit/Git/_Support/lvgit status.vi b/SimpleGit/Git/_Support/lvgit status.vi
index b09eeb4..065fe5a 100644
Binary files a/SimpleGit/Git/_Support/lvgit status.vi and b/SimpleGit/Git/_Support/lvgit status.vi differ
diff --git a/SimpleGit/Git/_Support/path to cmd argument.vi b/SimpleGit/Git/_Support/path to cmd argument.vi
new file mode 100644
index 0000000..f098ee4
Binary files /dev/null and b/SimpleGit/Git/_Support/path to cmd argument.vi differ
diff --git a/SimpleGit/Git/_scripts/Check_if_branch_exists.cmd b/SimpleGit/Git/_scripts/Check_if_branch_exists.cmd
index f3e26e1..5e21b32 100644
--- a/SimpleGit/Git/_scripts/Check_if_branch_exists.cmd
+++ b/SimpleGit/Git/_scripts/Check_if_branch_exists.cmd
@@ -8,8 +8,9 @@ REM constrained hosts (e.g. LabVIEW System Exec).
REM
REM Usage:
REM Check_if_branch_exists.cmd Check in current dir
-REM Check_if_branch_exists.cmd "D:\repo" Check in given repo
-REM (quote the repo path if it contains spaces; branch
+REM Check_if_branch_exists.cmd "D:\repo" Check in given repo dir
+REM Check_if_branch_exists.cmd "D:\repo\a.vi" Check by file directory
+REM (quote the path if it contains spaces; branch
REM names may contain slashes, e.g. "daily/2026-06-22")
REM
REM Output : prints TRUE if the local branch exists
@@ -24,16 +25,24 @@ REM ============================================================
REM --- Require a branch name (arg 1) ---
if "%~1"=="" goto :false
-REM --- Optional repo path (arg 2): branch in current dir vs given repo ---
-if not "%~2"=="" goto :withpath
+REM --- Optional path (arg 2): current dir vs given dir/file ---
+if "%~2"=="" goto :currentdir
+if exist "%~2\*" goto :withdir
+goto :withfile
+:currentdir
git show-ref --verify --quiet "refs/heads/%~1" 2>nul
if errorlevel 1 goto :false
goto :true
-:withpath
+:withdir
git -C "%~2" show-ref --verify --quiet "refs/heads/%~1" 2>nul
if errorlevel 1 goto :false
+goto :true
+
+:withfile
+git -C "%~dp2." show-ref --verify --quiet "refs/heads/%~1" 2>nul
+if errorlevel 1 goto :false
:true
echo TRUE
diff --git a/SimpleGit/Git/_scripts/Commit_all_changes.cmd b/SimpleGit/Git/_scripts/Commit_all_changes.cmd
new file mode 100644
index 0000000..2ae6207
--- /dev/null
+++ b/SimpleGit/Git/_scripts/Commit_all_changes.cmd
@@ -0,0 +1,43 @@
+@echo off
+REM ============================================================
+REM Commit_all_changes.cmd
+REM Stages and commits all modifications in a Git repository.
+REM
+REM Usage:
+REM Commit_all_changes.cmd "D:\repo path" "commit message"
+REM Commit_all_changes.cmd "D:\repo\a.vi" "commit message"
+REM
+REM Args:
+REM %1 = repository directory or file path (required)
+REM %2 = commit message (required)
+REM
+REM Output : git add / git commit output
+REM Exit : 0 = commit success
+REM 1 = missing args / not a Git repository / git error
+REM ============================================================
+
+if "%~1"=="" exit /b 1
+if "%~2"=="" exit /b 1
+
+if exist "%~1\*" goto :withdir
+goto :withfile
+
+:withdir
+git -C "%~1" rev-parse --is-inside-work-tree >nul 2>nul
+if errorlevel 1 exit /b 1
+
+git -C "%~1" add -A
+if errorlevel 1 exit /b 1
+
+git -C "%~1" commit -m "%~2"
+exit /b %errorlevel%
+
+:withfile
+git -C "%~dp1." rev-parse --is-inside-work-tree >nul 2>nul
+if errorlevel 1 exit /b 1
+
+git -C "%~dp1." add -A
+if errorlevel 1 exit /b 1
+
+git -C "%~dp1." commit -m "%~2"
+exit /b %errorlevel%
\ No newline at end of file
diff --git a/SimpleGit/Git/_scripts/Get_all_local_branches.cmd b/SimpleGit/Git/_scripts/Get_all_local_branches.cmd
index 65ba655..fd2b8fe 100644
--- a/SimpleGit/Git/_scripts/Get_all_local_branches.cmd
+++ b/SimpleGit/Git/_scripts/Get_all_local_branches.cmd
@@ -9,8 +9,9 @@ REM (e.g. LabVIEW System Exec).
REM
REM Usage:
REM Get_all_local_branches.cmd List in current directory
-REM Get_all_local_branches.cmd "D:\repo path" List in given repo path
-REM (quote the repo path if it contains spaces)
+REM Get_all_local_branches.cmd "D:\repo path" List in given repo directory
+REM Get_all_local_branches.cmd "D:\repo\a.vi" List using given file directory
+REM (quote the path if it contains spaces)
REM
REM Output : one branch per line; current branch prefixed with '*'
REM example:
@@ -22,13 +23,21 @@ REM Exit : 0 = success
REM 1 = not a Git repository / error
REM ============================================================
-if not "%~1"=="" goto :withpath
+if "%~1"=="" goto :currentdir
+if exist "%~1\*" goto :withdir
+goto :withfile
+:currentdir
REM --- No path given: use current directory ---
git branch
exit /b %errorlevel%
-:withpath
-REM --- Explicit repo path ---
+:withdir
+REM --- Explicit repo directory ---
git -C "%~1" branch
exit /b %errorlevel%
+
+:withfile
+REM --- Explicit file path: use its directory ---
+git -C "%~dp1." branch
+exit /b %errorlevel%
diff --git a/SimpleGit/Git/_scripts/Get_current_branch.cmd b/SimpleGit/Git/_scripts/Get_current_branch.cmd
index 332ad89..6c83f04 100644
--- a/SimpleGit/Git/_scripts/Get_current_branch.cmd
+++ b/SimpleGit/Git/_scripts/Get_current_branch.cmd
@@ -9,7 +9,8 @@ REM constrained hosts (e.g. LabVIEW System Exec).
REM
REM Usage:
REM Get_current_branch.cmd Use current directory
-REM Get_current_branch.cmd "D:\repo path" Use given repo path
+REM Get_current_branch.cmd "D:\repo path" Use given repo directory
+REM Get_current_branch.cmd "D:\repo\a.vi" Use directory of given file
REM (quote paths with spaces)
REM
REM Output : the branch name on success (e.g. "main")
@@ -24,11 +25,18 @@ REM nothing (instead of the literal "HEAD") when
REM the repository is in a detached-HEAD state.
REM ============================================================
-if not "%~1"=="" goto :withpath
+if "%~1"=="" goto :currentdir
+if exist "%~1\*" goto :withdir
+goto :withfile
+:currentdir
git branch --show-current 2>nul
exit /b %errorlevel%
-:withpath
+:withdir
git -C "%~1" branch --show-current 2>nul
exit /b %errorlevel%
+
+:withfile
+git -C "%~dp1." branch --show-current 2>nul
+exit /b %errorlevel%
diff --git a/SimpleGit/Git/_scripts/Get_current_commit.cmd b/SimpleGit/Git/_scripts/Get_current_commit.cmd
index 27124c5..db9b52c 100644
--- a/SimpleGit/Git/_scripts/Get_current_commit.cmd
+++ b/SimpleGit/Git/_scripts/Get_current_commit.cmd
@@ -9,7 +9,8 @@ REM constrained hosts (e.g. LabVIEW System Exec).
REM
REM Usage:
REM Get_current_commit.cmd Use current directory
-REM Get_current_commit.cmd "D:\repo path" Use given repo path
+REM Get_current_commit.cmd "D:\repo path" Use given repo directory
+REM Get_current_commit.cmd "D:\repo\a.vi" Use directory of given file
REM (quote paths with spaces)
REM
REM Output : the 40-char commit hash on success
@@ -22,11 +23,18 @@ REM nothing instead of the literal "HEAD". For the
REM short hash use 'rev-parse --short --verify HEAD'.
REM ============================================================
-if not "%~1"=="" goto :withpath
+if "%~1"=="" goto :currentdir
+if exist "%~1\*" goto :withdir
+goto :withfile
+:currentdir
git rev-parse --verify HEAD 2>nul
exit /b %errorlevel%
-:withpath
+:withdir
git -C "%~1" rev-parse --verify HEAD 2>nul
exit /b %errorlevel%
+
+:withfile
+git -C "%~dp1." rev-parse --verify HEAD 2>nul
+exit /b %errorlevel%
diff --git a/SimpleGit/Git/_scripts/Get_last_commit_message.cmd b/SimpleGit/Git/_scripts/Get_last_commit_message.cmd
index 8d8ffd5..35b2b8a 100644
--- a/SimpleGit/Git/_scripts/Get_last_commit_message.cmd
+++ b/SimpleGit/Git/_scripts/Get_last_commit_message.cmd
@@ -9,7 +9,8 @@ REM constrained hosts (e.g. LabVIEW System Exec).
REM
REM Usage:
REM Get_last_commit_message.cmd Use current directory
-REM Get_last_commit_message.cmd "D:\repo path" Use given repo path
+REM Get_last_commit_message.cmd "D:\repo path" Use given repo directory
+REM Get_last_commit_message.cmd "D:\repo\a.vi" Use directory of given file
REM (quote paths with spaces)
REM
REM Output : the last commit subject line on success
@@ -22,11 +23,18 @@ REM placeholder '%s' through cmd. Use '%%B' for the
REM full message body instead of just the subject.
REM ============================================================
-if not "%~1"=="" goto :withpath
+if "%~1"=="" goto :currentdir
+if exist "%~1\*" goto :withdir
+goto :withfile
+:currentdir
git log -1 --format=%%s 2>nul
exit /b %errorlevel%
-:withpath
+:withdir
git -C "%~1" log -1 --format=%%s 2>nul
exit /b %errorlevel%
+
+:withfile
+git -C "%~dp1." log -1 --format=%%s 2>nul
+exit /b %errorlevel%
diff --git a/SimpleGit/Git/_scripts/List_uncommitted_files.cmd b/SimpleGit/Git/_scripts/List_uncommitted_files.cmd
new file mode 100644
index 0000000..0c0e61c
--- /dev/null
+++ b/SimpleGit/Git/_scripts/List_uncommitted_files.cmd
@@ -0,0 +1,54 @@
+@echo off
+REM ============================================================
+REM List_uncommitted_files.cmd
+REM Lists all uncommitted files in a Git repository and prefixes
+REM each path with its status class.
+REM
+REM Usage:
+REM List_uncommitted_files.cmd Use current directory
+REM List_uncommitted_files.cmd "D:\repo path" Use given repo directory
+REM List_uncommitted_files.cmd "D:\repo\a.vi" Use directory of given file
+REM
+REM Output : one file per line with a prefix:
+REM [staged]
+REM [unstaged]
+REM [untracked]
+REM [conflict]
+REM A file may appear multiple times if it belongs to
+REM multiple classes (for example staged + unstaged).
+REM Exit : 0 = success, 1 = not a Git repository / error
+REM ============================================================
+
+if "%~1"=="" goto :currentdir
+if exist "%~1\*" goto :withdir
+goto :withfile
+
+:currentdir
+git rev-parse --is-inside-work-tree >nul 2>nul
+if errorlevel 1 exit /b 1
+
+for /f "delims=" %%F in ('git diff --cached --name-only 2^>nul') do echo [staged] %%F
+for /f "delims=" %%F in ('git diff --name-only 2^>nul') do echo [unstaged] %%F
+for /f "delims=" %%F in ('git ls-files --others --exclude-standard 2^>nul') do echo [untracked] %%F
+for /f "delims=" %%F in ('git diff --name-only --diff-filter=U 2^>nul') do echo [conflict] %%F
+exit /b 0
+
+:withdir
+git -C "%~1" rev-parse --is-inside-work-tree >nul 2>nul
+if errorlevel 1 exit /b 1
+
+for /f "delims=" %%F in ('git -C "%~1" diff --cached --name-only 2^>nul') do echo [staged] %%F
+for /f "delims=" %%F in ('git -C "%~1" diff --name-only 2^>nul') do echo [unstaged] %%F
+for /f "delims=" %%F in ('git -C "%~1" ls-files --others --exclude-standard 2^>nul') do echo [untracked] %%F
+for /f "delims=" %%F in ('git -C "%~1" diff --name-only --diff-filter=U 2^>nul') do echo [conflict] %%F
+exit /b 0
+
+:withfile
+git -C "%~dp1." rev-parse --is-inside-work-tree >nul 2>nul
+if errorlevel 1 exit /b 1
+
+for /f "delims=" %%F in ('git -C "%~dp1." diff --cached --name-only 2^>nul') do echo [staged] %%F
+for /f "delims=" %%F in ('git -C "%~dp1." diff --name-only 2^>nul') do echo [unstaged] %%F
+for /f "delims=" %%F in ('git -C "%~dp1." ls-files --others --exclude-standard 2^>nul') do echo [untracked] %%F
+for /f "delims=" %%F in ('git -C "%~dp1." diff --name-only --diff-filter=U 2^>nul') do echo [conflict] %%F
+exit /b 0
\ No newline at end of file
diff --git a/SimpleGit/Git/_scripts/Pull_with_prune.cmd b/SimpleGit/Git/_scripts/Pull_with_prune.cmd
index 24cf893..f4e245f 100644
--- a/SimpleGit/Git/_scripts/Pull_with_prune.cmd
+++ b/SimpleGit/Git/_scripts/Pull_with_prune.cmd
@@ -11,8 +11,9 @@ REM (e.g. LabVIEW System Exec).
REM
REM Usage:
REM Pull_with_prune.cmd Pull in current directory
-REM Pull_with_prune.cmd "D:\repo path" Pull in given repo path
-REM (quote the repo path if it contains spaces)
+REM Pull_with_prune.cmd "D:\repo path" Pull in given repo directory
+REM Pull_with_prune.cmd "D:\repo\a.vi" Pull using given file directory
+REM (quote the path if it contains spaces)
REM
REM Output : git pull output (status, merge result, prune details)
REM error messages on failure
@@ -23,13 +24,21 @@ REM options (e.g. --rebase), invoke git directly or modify
REM the script to pass them.
REM ============================================================
-if not "%~1"=="" goto :withpath
+if "%~1"=="" goto :currentdir
+if exist "%~1\*" goto :withdir
+goto :withfile
+:currentdir
REM --- No path given: use current directory ---
git pull --prune
exit /b %errorlevel%
-:withpath
-REM --- Explicit repo path ---
+:withdir
+REM --- Explicit repo directory ---
git -C "%~1" pull --prune
exit /b %errorlevel%
+
+:withfile
+REM --- Explicit file path: use its directory ---
+git -C "%~dp1." pull --prune
+exit /b %errorlevel%
diff --git a/SimpleGit/Git/_scripts/Push_current_branch.cmd b/SimpleGit/Git/_scripts/Push_current_branch.cmd
index 71597cb..b30d38a 100644
--- a/SimpleGit/Git/_scripts/Push_current_branch.cmd
+++ b/SimpleGit/Git/_scripts/Push_current_branch.cmd
@@ -10,8 +10,9 @@ REM (e.g. LabVIEW System Exec).
REM
REM Usage:
REM Push_current_branch.cmd Push in current directory
-REM Push_current_branch.cmd "D:\repo path" Push in given repo path
-REM (quote the repo path if it contains spaces)
+REM Push_current_branch.cmd "D:\repo path" Push in given repo directory
+REM Push_current_branch.cmd "D:\repo\a.vi" Push using given file directory
+REM (quote the path if it contains spaces)
REM
REM Output : git push output (branch details, remote updates)
REM error messages on failure
@@ -22,13 +23,21 @@ REM as the source ref to ensure ONLY the current branch
REM is pushed, never other branches.
REM ============================================================
-if not "%~1"=="" goto :withpath
+if "%~1"=="" goto :currentdir
+if exist "%~1\*" goto :withdir
+goto :withfile
+:currentdir
REM --- No path given: use current directory ---
git push origin HEAD
exit /b %errorlevel%
-:withpath
-REM --- Explicit repo path ---
+:withdir
+REM --- Explicit repo directory ---
git -C "%~1" push origin HEAD
exit /b %errorlevel%
+
+:withfile
+REM --- Explicit file path: use its directory ---
+git -C "%~dp1." push origin HEAD
+exit /b %errorlevel%
diff --git a/SimpleGit/Git/_scripts/Run cmd File.vi b/SimpleGit/Git/_scripts/Run cmd File.vi
index aa1e532..47cfdf4 100644
Binary files a/SimpleGit/Git/_scripts/Run cmd File.vi and b/SimpleGit/Git/_scripts/Run cmd File.vi differ
diff --git a/SimpleGit/Git/_scripts/Switch_or_create_branch.cmd b/SimpleGit/Git/_scripts/Switch_or_create_branch.cmd
index bed4119..8b26a66 100644
--- a/SimpleGit/Git/_scripts/Switch_or_create_branch.cmd
+++ b/SimpleGit/Git/_scripts/Switch_or_create_branch.cmd
@@ -12,8 +12,9 @@ REM (e.g. LabVIEW System Exec).
REM
REM Usage:
REM Switch_or_create_branch.cmd Switch in current dir
-REM Switch_or_create_branch.cmd "D:\repo" Switch in given repo
-REM (quote the repo path if it contains spaces;
+REM Switch_or_create_branch.cmd "D:\repo" Switch in given repo dir
+REM Switch_or_create_branch.cmd "D:\repo\a.vi" Switch by file directory
+REM (quote the path if it contains spaces;
REM branch name must be a valid Git name: alphanumeric,
REM hyphens, underscores, slashes; avoid special chars)
REM
@@ -31,9 +32,12 @@ REM ============================================================
REM --- Require branch name (arg 1) ---
if "%~1"=="" goto :error
-REM --- Optional repo path (arg 2) ---
-if not "%~2"=="" goto :withpath
+REM --- Optional path (arg 2): current dir vs given dir/file ---
+if "%~2"=="" goto :currentdir
+if exist "%~2\*" goto :withdir
+goto :withfile
+:currentdir
REM --- Current directory ---
git checkout "%~1" 2>nul
if errorlevel 1 goto :tryremote_currentdir
@@ -48,8 +52,8 @@ exit /b 0
git checkout -b "%~1"
exit /b %errorlevel%
-:withpath
-REM --- Explicit repo path (arg 2) ---
+:withdir
+REM --- Explicit repo directory (arg 2) ---
git -C "%~2" checkout "%~1" 2>nul
if errorlevel 1 goto :tryremote_withpath
exit /b 0
@@ -63,6 +67,21 @@ exit /b 0
git -C "%~2" checkout -b "%~1"
exit /b %errorlevel%
+:withfile
+REM --- Explicit file path (arg 2): use its directory ---
+git -C "%~dp2." checkout "%~1" 2>nul
+if errorlevel 1 goto :tryremote_withfile
+exit /b 0
+
+:tryremote_withfile
+git -C "%~dp2." checkout -b "%~1" "origin/%~1" 2>nul
+if errorlevel 1 goto :createnew_withfile
+exit /b 0
+
+:createnew_withfile
+git -C "%~dp2." checkout -b "%~1"
+exit /b %errorlevel%
+
:error
echo Branch name is required.
exit /b 1
diff --git a/SimpleGit/Git/_scripts/Switch_to_main_branch.cmd b/SimpleGit/Git/_scripts/Switch_to_main_branch.cmd
index 3c88231..3b61d18 100644
--- a/SimpleGit/Git/_scripts/Switch_to_main_branch.cmd
+++ b/SimpleGit/Git/_scripts/Switch_to_main_branch.cmd
@@ -12,8 +12,9 @@ REM (e.g. LabVIEW System Exec).
REM
REM Usage:
REM Switch_to_main_branch.cmd Switch in current directory
-REM Switch_to_main_branch.cmd "D:\repo path" Switch in given repo path
-REM (quote the repo path if it contains spaces)
+REM Switch_to_main_branch.cmd "D:\repo path" Switch in given repo directory
+REM Switch_to_main_branch.cmd "D:\repo\a.vi" Switch using given file directory
+REM (quote the path if it contains spaces)
REM
REM Output : git checkout message (e.g. "Switched to branch 'main'")
REM error message if neither main nor master exist
@@ -21,8 +22,11 @@ REM Exit : 0 = success (switched to main or master)
REM 1 = error (neither main nor master found / not a repo)
REM ============================================================
-if not "%~1"=="" goto :withpath
+if "%~1"=="" goto :currentdir
+if exist "%~1\*" goto :withdir
+goto :withfile
+:currentdir
REM --- Current directory ---
git show-ref --verify --quiet "refs/heads/main" 2>nul
if errorlevel 1 goto :check_master_currentdir
@@ -39,8 +43,8 @@ exit /b 0
echo ERROR: Neither 'main' nor 'master' branch found.
exit /b 1
-:withpath
-REM --- Explicit repo path ---
+:withdir
+REM --- Explicit repo directory ---
git -C "%~1" show-ref --verify --quiet "refs/heads/main" 2>nul
if errorlevel 1 goto :check_master_withpath
git -C "%~1" checkout -q main
@@ -55,3 +59,20 @@ exit /b 0
:error_withpath
echo ERROR: Neither 'main' nor 'master' branch found.
exit /b 1
+
+:withfile
+REM --- Explicit file path: use its directory ---
+git -C "%~dp1." show-ref --verify --quiet "refs/heads/main" 2>nul
+if errorlevel 1 goto :check_master_withfile
+git -C "%~dp1." checkout -q main
+exit /b 0
+
+:check_master_withfile
+git -C "%~dp1." show-ref --verify --quiet "refs/heads/master" 2>nul
+if errorlevel 1 goto :error_withfile
+git -C "%~dp1." checkout -q master
+exit /b 0
+
+:error_withfile
+echo ERROR: Neither 'main' nor 'master' branch found.
+exit /b 1