'Piping equivalent on powershell

On unix, I'd run a command like this:

$ git diff origin/master origin/dev -- <file/dir> | git apply -

Which would basically apply all the differences between the two branches to my current working copy.

I love using this command, but my coworker is on a Windows machine, and powershell apparently doesn't do | pipes the same way.

What's a one-liner in powershell that would let us do this same command?



Solution 1:[1]

As with most things PowerShell you might want to investigate whether there's a module that might help you. For example, the best known is probably posh-git

You can solve your problem more directly, though, because if you're using git on Windows, you are almost certainly using Git for Windows, which includes a bash shell. The standard install adds "Git Bash here" to the context menu, so from Windows explorer you can open the shell in a folder of your choice.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dominic Cronin