-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsync_from_remote.bat
More file actions
32 lines (27 loc) · 820 Bytes
/
sync_from_remote.bat
File metadata and controls
32 lines (27 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@echo off
REM Check if the current directory is a Git repository
git rev-parse --is-inside-work-tree 1>nul 2>nul
IF %ERRORLEVEL% NEQ 0 (
echo This directory is not a Git repository.
exit /b 1
)
REM Fetch the latest changes from the remote repository
echo Fetching the latest changes from the remote repository...
git fetch origin
REM Check if fetch was successful
IF %ERRORLEVEL% NEQ 0 (
echo Failed to fetch changes.
exit /b 1
)
REM Reset the local branch to match the remote branch
echo Resetting the local branch to match the remote branch...
git reset --hard origin/main
REM Check if reset was successful
IF %ERRORLEVEL% EQU 0 (
echo Local branch successfully reset to match the remote branch.
) ELSE (
echo Failed to reset local branch.
exit /b 1
)
echo Script completed.
exit /b 0