Git自动更新

2019-06-17 工作记录
@Echo off
color 0e
Title Git 更新
:begin
d:
cd D:\1\2
cls
Echo.请选择需要的操作
Echo        1 更新主分支
Echo        2 更新2
Echo.
Echo        3 切换到主分支
Echo        4 切换到2
Echo.
::Echo 6 服务器切换为内网
::Echo 7 服务器切换为外网
Echo        8 更新3
Echo.
Echo        9 强更主分支
Echo.
Echo        0 退出

Set /P Choice=      请输入数字 ,然后按回车:


If not "%Choice%"=="" (
  If "%Choice%"=="0" (
    exit
  )  
  
  If "%Choice%"=="9" (
    Echo on 
    git fetch --all && git reset --hard origin/master && git pull
    pause  
    Echo off 
    goto :begin
  )
  
  If "%Choice%"=="8" (
    Echo on 
    cd D:\3 
    git pull origin master 
    pause 
    cd D:\1\2 
    Echo off 
    goto :begin
  )
  
  If "%Choice%"=="7" (
    goto serverA 
    goto :begin
  )
  
  If "%Choice%"=="6" (
    goto serverB 
    goto :begin
  )
  
  If "%Choice%"=="4" (
    Echo on 
    git checkout 3 
    pause 
    Echo off 
    goto :begin
  )
  
  If "%Choice%"=="3" (
    Echo on 
    git checkout master 
    pause  
    Echo off 
    goto :begin
  )
  
  If "%Choice%"=="2" (
    Echo on 
    git pull origin 3 
    pause  
    Echo off 
    goto :begin
  )
  
  If "%Choice%"=="1" (
    Echo on 
    git pull origin master 
    pause 
    Echo off 
    goto :begin
  )
)
Echo. pause
Comments
Write a Comment