Windows相当于这个gitk Linux命令

时间:2015-06-16 20:27:52

标签: linux windows git powershell awk

从此SO:How to recover a dropped stash in Git?

我想将此Linux命令转换为Windows等效命令,或者这个命令在Windows上是合法的,不确定$|

gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

我尝试在我的Windows Git Shell,Powershell和Cmd.exe上运行此cmd,我的cd是git目录,使用Cmd.exe:

enter image description here

在Git Shell上:

enter image description here

这给了我以下错误:

enter image description here

我已经安装了gawk:http://gnuwin32.sourceforge.net/packages/gawk.htm

并将C:\Program Files (x86)\GnuWin32\bin添加到我的Path环境变量

2 个答案:

答案 0 :(得分:1)

好的,所以我必须安装gawk / awk:memory leak

然后我更新了我的Path环境变量:C:\Program Files (x86)\GnuWin32\bin\

然后我不得不重新启动计算机以刷新环境变量。

然后我可以在没有任何更改的情况下运行gitk cmd,在Windows机器上运行正常:

gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

但它必须在Windows Git Shell中,cmd在Windows cmd.exe中不起作用。

答案 1 :(得分:1)

以下是Windows PowerShell等效项:

gitk --all $(git fsck --no-reflog | Select-String "(dangling commit )(.*)" | %{ $_.Line.Split(' ')[2] })

相关问题