I'm trying to get git show-branch
to tell me if a branch exists using Window 7 cmd, for that I've set a .bat file and I'm trying to filter the git command output, and I know that git outputs to STDERR.
for /f %%L in ('git show-branch remotes/origin/develop-7.x 2^> nul ^| findstr /b "fatal"') do set VAR=%%L
echo %VAR%
My git command output is this:
fatal: bad sha1 reference remotes/origin/develop-7.x
The problem is that I can't get to pipe STDERR to findstr and VAR to give me something at all.
If I add &1
to 2^>&1 1>nul
I get an error & was unexpected at this time