[英]Piping equivalent on powershell
On unix, I'd run a command like this:在 unix 上,我会运行这样的命令:
$ 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 |
我喜欢使用这个命令,但我的同事在一台 Windows 机器上,而 powershell 显然不行
|
pipes the same way.管道以相同的方式。
What's a one-liner in powershell that would let us do this same command? powershell 中允许我们执行相同命令的单行代码是什么?
As with most things PowerShell you might want to investigate whether there's a module that might help you.与大多数事情 PowerShell 一样,您可能想调查是否有一个模块可以帮助您。 For example, the best known is probably posh-git
例如,最著名的可能是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.不过,您可以更直接地解决您的问题,因为如果您在 Windows 上使用 git,您几乎可以肯定使用 Git 作为 Windows,其中包括 bash shell。标准安装将“Git 菜单 5 添加到 683 827”,因此 683 827从 Windows 资源管理器中,您可以在您选择的文件夹中打开 shell。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.