@echo off
set working_dir="D:\Projects\NestJsApiProject"
set /P stash_name= Enter stash name:
set /P branch_name= Enter new branch name:
set /P commit_des= Enter commit description:
set /P isFeature= Is it a feature?Y/N:
set branch_type= features/
if %isFeature%==N (
set branch_type= bugs/
)
echo %branch_type%
echo %stash_name%
echo %branch_name%
set /P areYouSure= You are going to create a branch named "%branch_type%%branch_name%", are u sure?Y/N:
if %areYouSure%==Y (
cd /D %working_dir%
git stash save %stash_name%
git checkout pre-dev
git pull origin pre-dev
git stash pop stash@{0}
git stash save %stash_name%
git checkout root-branch
git pull origin root-branch
git branch %branch_type%%branch_name%
git checkout %branch_type%%branch_name%
git stash apply stash@{0}
git add .
git commit -m "%branch_name% %commit_des%"
git push origin %branch_type%%branch_name%
git checkout pre-dev
git pull origin pre-dev
git stash apply stash@{0}
git add .
git commit -m "%branch_name%# %commit_des%"
git push origin pre-dev
)
pause
above code solve my problem, but when conflicts occur with some files it just pushes the conflicted files which I don't want, Is there any way to pause the command window if any conflict occurs