mirror of
https://gitlab.com/ProcyonLotor/vrchat-template.git
synced 2026-08-25 10:43:53 +05:00
Added convenience shell scripts
This commit is contained in:
@@ -61,6 +61,14 @@ or run this command in project's folder on Windows
|
|||||||
> this is because VPM has not loaded yet and didn't resolved the required packages, ignore the errors and continue loading.
|
> this is because VPM has not loaded yet and didn't resolved the required packages, ignore the errors and continue loading.
|
||||||
> Sometimes you may need to reopen the project couple times for all packages to resolve and scripts to recompile.
|
> Sometimes you may need to reopen the project couple times for all packages to resolve and scripts to recompile.
|
||||||
|
|
||||||
|
## Convenience scripts
|
||||||
|
|
||||||
|
The template also have some convenience shell scripts for both Windows and Linux:
|
||||||
|
|
||||||
|
- `./repo-cleanup.*` - Cleans up all untracked trash in the working tree (i.e. `Library/`, `Build/`, etc.)
|
||||||
|
- `./repo-discard.*` - Reverts all changed files back to the state of the last commit
|
||||||
|
- `./repo-reset.*` - Completely resets the state of the local repo to the state of the remote repository (dangerous, use with caution!)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
For project's license see [LICENSE](./LICENSE) file.
|
For project's license see [LICENSE](./LICENSE) file.
|
||||||
|
|||||||
25
repo-cleanup.cmd
Normal file
25
repo-cleanup.cmd
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
TITLE Clean up Unity Project repo
|
||||||
|
SETLOCAL EnableDelayedExpansion
|
||||||
|
|
||||||
|
CD "%~dp0"
|
||||||
|
git rev-parse --is-inside-work-tree >NUL || GOTO die
|
||||||
|
|
||||||
|
git clean -dfX --dry-run "%~dp0." || GOTO die
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
CHOICE /M "Execute"
|
||||||
|
IF !ERRORLEVEL! NEQ 1 (
|
||||||
|
ECHO Aborting cleanup...
|
||||||
|
) ELSE (
|
||||||
|
git clean -dfX "%~dp0." || GOTO die
|
||||||
|
ECHO Done.
|
||||||
|
)
|
||||||
|
|
||||||
|
:end
|
||||||
|
PAUSE
|
||||||
|
EXIT /B 0
|
||||||
|
|
||||||
|
:die
|
||||||
|
PAUSE
|
||||||
|
EXIT /B %ERRORLEVEL%
|
||||||
18
repo-cleanup.sh
Executable file
18
repo-cleanup.sh
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
repository="$(dirname "$(readlink -f "$0")")/."
|
||||||
|
|
||||||
|
cd "${repository}"
|
||||||
|
git rev-parse --is-inside-work-tree >/dev/null
|
||||||
|
|
||||||
|
git clean -dfX --dry-run "${repository}"
|
||||||
|
|
||||||
|
printf "\nExecute [Y,N]?"; read -r yn
|
||||||
|
if [ "$yn" = "${yn#[Yy]}" ]; then
|
||||||
|
echo "Aborting cleanup..."
|
||||||
|
else
|
||||||
|
git clean -dfX "${repository}"
|
||||||
|
echo "Done."
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
27
repo-discard.cmd
Normal file
27
repo-discard.cmd
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
TITLE Restore Unity Project repo
|
||||||
|
SETLOCAL
|
||||||
|
|
||||||
|
CD "%~dp0"
|
||||||
|
git rev-parse --is-inside-work-tree >NUL || GOTO die
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
ECHO *** WARNING: The following files were changed and will be reverted:
|
||||||
|
git diff --name-only HEAD
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
CHOICE /M "Execute"
|
||||||
|
IF %ERRORLEVEL% NEQ 1 (
|
||||||
|
ECHO Aborting discard...
|
||||||
|
) ELSE (
|
||||||
|
git restore "%~dp0." || GOTO die
|
||||||
|
ECHO Done.
|
||||||
|
)
|
||||||
|
|
||||||
|
:end
|
||||||
|
PAUSE
|
||||||
|
EXIT /B 0
|
||||||
|
|
||||||
|
:die
|
||||||
|
PAUSE
|
||||||
|
EXIT /B %ERRORLEVEL%
|
||||||
20
repo-discard.sh
Executable file
20
repo-discard.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
repository="$(dirname "$(readlink -f "$0")")/."
|
||||||
|
|
||||||
|
cd "${repository}"
|
||||||
|
git rev-parse --is-inside-work-tree >/dev/null
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** WARNING: The following files were changed and will be reverted:"
|
||||||
|
git diff --name-only HEAD
|
||||||
|
|
||||||
|
printf "\nExecute [Y,N]?"; read -r yn
|
||||||
|
if [ "$yn" = "${yn#[Yy]}" ]; then
|
||||||
|
echo "Aborting discard..."
|
||||||
|
else
|
||||||
|
git restore "${repository}"
|
||||||
|
echo "Done."
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
42
repo-reset.cmd
Normal file
42
repo-reset.cmd
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
TITLE Reset Unity Project repo
|
||||||
|
SETLOCAL
|
||||||
|
|
||||||
|
CD "%~dp0"
|
||||||
|
git rev-parse --is-inside-work-tree >NUL || GOTO die
|
||||||
|
|
||||||
|
FOR /F "delims=" %%x IN ('git rev-parse --abbrev-ref "@{u}" 2^>NUL') DO SET "upstream=%%x"
|
||||||
|
IF NOT DEFINED upstream (
|
||||||
|
ECHO *** ERROR: No upstream is configured for current branch
|
||||||
|
GOTO die
|
||||||
|
)
|
||||||
|
|
||||||
|
git fetch --all || GOTO die
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
ECHO Going to reset current branch to: %upstream%
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
ECHO *** WARNING: These local commits will be lost:
|
||||||
|
git log "%upstream%..HEAD" --oneline
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
ECHO *** WARNING: These local files will be reset:
|
||||||
|
git diff "HEAD..%upstream%" --name-only
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
CHOICE /M "Execute"
|
||||||
|
IF %ERRORLEVEL% NEQ 1 (
|
||||||
|
ECHO Aborting reset...
|
||||||
|
) ELSE (
|
||||||
|
git reset --hard "%upstream%" || GOTO die
|
||||||
|
ECHO Done.
|
||||||
|
)
|
||||||
|
|
||||||
|
:end
|
||||||
|
PAUSE
|
||||||
|
EXIT /B 0
|
||||||
|
|
||||||
|
:die
|
||||||
|
PAUSE
|
||||||
|
EXIT /B %ERRORLEVEL%
|
||||||
33
repo-reset.sh
Executable file
33
repo-reset.sh
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
cd "$(dirname "$(readlink -f "$0")")"
|
||||||
|
git rev-parse --is-inside-work-tree >/dev/null
|
||||||
|
|
||||||
|
upstream="$(git rev-parse --abbrev-ref "@{u}" 2>/dev/null || true)"
|
||||||
|
if [ -z "$upstream" ]; then
|
||||||
|
echo "*** ERROR: No upstream is configured for current branch"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git fetch --all
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Going to reset current branch to: ${upstream}"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** WARNING: These local commits will be lost:"
|
||||||
|
git log "${upstream}..HEAD" --oneline
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** WARNING: These local files will be reset:"
|
||||||
|
git diff "HEAD..${upstream}" --name-only
|
||||||
|
|
||||||
|
printf "\nExecute [Y,N]?"; read -r yn
|
||||||
|
if [ "$yn" = "${yn#[Yy]}" ]; then
|
||||||
|
echo "Aborting reset..."
|
||||||
|
else
|
||||||
|
git reset --hard "$upstream"
|
||||||
|
echo "Done."
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user