Ниже приведен пакетный скрипт, в котором я выполняю набор операций git, как я могу потерпеть неудачу при ошибке git, как при проверке git «Ветка уже выходит»
`` `
REM arg 1 = branch to copy
REM arg 2 = branch in which copy will be merged
set arg1=%1%
set arg2=%2%
echo copying %arg1% to %arg2%
echo "check out as tmp "+%arg1%
set ret = git checkout -b tmp %arg1%
echo %ret%
set ret = git checkout -b tmp %arg1%
echo %ret%
exit 0
REM emitted code for brevity
`` `
вывод:
c:\my-project>c:\bat\git-copy-branch.bat master my-git-branch
c:\my-project>git checkout -b tmp master
fatal: A branch named 'tmp' already exists.
c:\my-project>git checkout -b tmp master
fatal: A branch named 'tmp' already exists.
c:\my-project>git checkout -b tmp master
fatal: A branch named 'tmp' already exists.