bad revision ‘rm’ error, when using git filter-branch –index-filter if called from batch file

I was trying to move a few directories from one repository to another and answer http://stackoverflow.com/a/17867910/52277 suggests to use

    git filter-branch –index-filter ‘git rm –cached -qr –ignore-unmatch — . && git reset -q $GIT_COMMIT — apps/AAA libs/XXX’ –prune-empty — –all
I’ve put the command into batch file and got the error
> fatal: bad revision ‘rm’
The same error happened for an example from git documentation https://git-scm.com/docs/git-filter-branch
    git filter-branch –index-filter ‘git rm –cached –ignore-unmatch — buildMaster.bat’ HEAD
However when I was running the command in git bash, it didn’t  show any error and worked successfully.

It was acceptable for me. But I am still curious why including inside .bat cause an error with unclear message

Advertisements

#batch, #branches, #error, #git