简体   繁体   English

Windows等效于此gitk Linux命令

[英]Windows equivalent of this gitk Linux command

From this SO: How to recover a dropped stash in Git? 从这个SO: 如何在Git中恢复掉下的存储?

I would like to convert this Linux command to the Windows equivalent or maybe this is command is syntacially correct for Windows, not sure about the $ and the | 我想将此Linux命令转换为Windows等效命令,或者这对于Windows在语法上是正确的,不确定$| :

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

I have tried running this cmd on my Windows Git Shell, Powershell and Cmd.exe, with my cd being a git directory, with Cmd.exe: 我试过在Windows Git Shell,Powershell和Cmd.exe上运行此cmd,其中cd为git目录,并带有Cmd.exe:

在此处输入图片说明

On Git Shell: 在Git Shell上:

在此处输入图片说明

Which gives me the following error: 这给了我以下错误:

在此处输入图片说明

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

And added C:\\Program Files (x86)\\GnuWin32\\bin to my Path Environment Variables 并将C:\\Program Files (x86)\\GnuWin32\\bin到我的Path环境变量中

Ok so I had to install gawk/awk: http://gnuwin32.sourceforge.net/packages/gawk.htm 好的,所以我必须安装gawk / awk: http : //gnuwin32.sourceforge.net/packages/gawk.htm

Then I updated my Path Environment Variable: C:\\Program Files (x86)\\GnuWin32\\bin\\ 然后我更新了Path环境变量: C:\\Program Files (x86)\\GnuWin32\\bin\\

Then I had to restart my computer to refresh Environment Variables. 然后,我必须重新启动计算机以刷新环境变量。

Then I could run the gitk cmd, without any changes, works fine on a Windows machine: 然后,我可以运行gitk cmd,而无需进行任何更改,就可以在Windows机器上正常运行:

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

But it has to be in Windows Git Shell, the cmd did not work from Windows cmd.exe. 但是它必须在Windows Git Shell中,该cmd不能从Windows cmd.exe运行。

这是Windows PowerShell等效项:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM