Skip to content

Instantly share code, notes, and snippets.

@Phury
Created April 20, 2022 09:05
Show Gist options
  • Select an option

  • Save Phury/ffeb9a2790f97fcb51ceaca6f042a330 to your computer and use it in GitHub Desktop.

Select an option

Save Phury/ffeb9a2790f97fcb51ceaca6f042a330 to your computer and use it in GitHub Desktop.
Loop through lines in a input.conf file and execute commands from there
@echo off
REM input.conf structure :
REM sub_folder_1,1.1.0,1.2.0
REM sub_folder_2,1.2.0,1.3.0
REM here we checkout a project a create a new branch
for /F "tokens=*" %%r in (input.conf) do (
for /F "tokens=1,2,3,4 delims=," %%A in ("%%r") do (
cd %%A
pwd
git checkout tags/%%A-%%B
echo "creating new develop branch %%C"
git checkout -b %%C-develop
REM also update the version in the maven project
if exist pom.xml (
echo "Update maven version to %%C-SNAPSHOT"
mvn versions:set -DnewVersion=%%C-SNAPSHOT
)
git add .
git commit -m "prepare next version: %%C"
git push --set-upstream origin %%C-develop
cd ..
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment