'git am < MyFix.patch' command error in Powershell

情到浓时终转凉″ 提交于 2019-12-02 09:49:25

问题


How do we get this command to run on Powershell with out error : The '<' operator is reserved for future use.

C:\Users\Me\my-git-repo > git am < MyFix.patch
    The '<' operator is reserved for future use.
    At line:1 char:9
    + git am < <<<<  MyFix.patch
    + CategoryInfo          : ParserError: (<:OperatorToken) [],..      
    + FullyQualifiedErrorId : RedirectionNotSupported

回答1:


Use either:

Get-Content MyFix.patch | git am

or:

cmd /c 'git am < MyFix.patch'

Both should work equally well. Windows Powershell simply doesn't support IO redirection with < for now, so you either need to pipe the text to stdin using | (Get-Content[1] sends the contents of MyFix.patch to stdout and | feeds it along to git am's stdin); alternatively, run the command through CMD.exe.


[1] Alternatively, use the built-in alias type.



来源:https://stackoverflow.com/questions/24527941/git-am-myfix-patch-command-error-in-powershell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!