Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
feat(tools): add batch script to archive branch
Browse files Browse the repository at this point in the history
  • Loading branch information
GiuseppePiscopo committed Oct 14, 2016
1 parent 1e26439 commit f6c8882
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tools/archive-branch.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@ECHO OFF
REM archive-branch.bat
REM Usage: archive-branch <your-branch-name>

:TopOfScript
ECHO.
ECHO Starting...

IF "%~1"=="" (
ECHO This command requires 1 input argument.
ECHO.
ECHO Usage: archive-branch ^<your-branch-name^>

GOTO :EndOfScript
)

ECHO.
ECHO * 1. Get local branch from remote, if needed
ECHO.
git checkout %1
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 2. Go back to master
ECHO.
git checkout master
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 3. Create local tag
ECHO.
git tag archive/%1 %1
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 4. Create remote tag
ECHO.
git push origin archive/%1
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 5. Delete local branch
ECHO.
git branch -d %1
IF %ERRORLEVEL% neq 0 GOTO :Err

ECHO.
ECHO * 6. Delete remote branch
ECHO.
git push origin --delete %1
IF %ERRORLEVEL% neq 0 GOTO :Err

GOTO :EndOfScript

:Err
ECHO Errors encountered during execution. Last command exited with status: %ERRORLEVEL%.

:EndOfScript
ECHO.
ECHO Finished

0 comments on commit f6c8882

Please sign in to comment.