3956

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

Question:

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

Answer1:

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<sup>[1]</sup> sends the contents of MyFix.patch to stdout and | feeds it along to git am's stdin); alternatively, run the command through CMD.exe.

<hr />

<sup>[1] Alternatively, use the built-in alias type.</sup>

Recommend

  • Powershell | Unable to perform command with space character
  • Auto adjust width of divs on show/hide of one div in bootstrap html
  • Does Accurev support stashing?
  • Delphi: how to compose an email in Outlook without using MAPI?
  • Get-AdComputer -filter parameter not accepting Get-Date output
  • Dropping support for JRE 1.3
  • “Complex Header” not responsive in current DataTables.net build?
  • How to set `secure` and `httpOnly` for Plones `__ac` cookie?
  • powershell Get-Counter -ComputerName parameter on Windows 7
  • Angular2 Response for preflight is invalid (redirect) from some GET requests
  • Selenium to click on a javascript button corresponding to a text
  • IE11 throwing “SCRIPT1014: invalid character” where all other browsers work
  • Simulate click Geckofx vb,net
  • IE7 and TinyMCE with Plone
  • How to view images from protected folder with php?
  • Moving Android View and preventing onDraw to be called over and over again
  • Appending Character to Character Array In C
  • MonoTouch: How to download pdf incrementally as indicated in the Apple slides “Building Newsstand Ap
  • How to have background script and something similar to a default popup?
  • How to attach a node.js readable stream to a Sendgrid email?
  • Listbox within Listbox and scrolling trouble in Windows Phone 7 Silverlight
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • Using $this when not in object context
  • How do I fake an specific browser client when using Java's Net library?
  • Align navbar back button on right side
  • How reduce the height of an mschart by breaking up the y-axis
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • AES padding and writing the ciphertext to a disk file
  • Perl system calls when running as another user using sudo
  • Convert array of 8 bytes to signed long in C++
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Linker errors when using intrinsic function via function pointer
  • Load html files in TinyMce
  • Free memory of cv::Mat loaded using FileStorage API
  • LevelDB C iterator
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?