简体   繁体   中英

Windows equivalent of this gitk Linux command

From this SO: How to recover a dropped stash in 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 | :

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:

在此处输入图片说明

On Git Shell:

在此处输入图片说明

Which gives me the following error:

在此处输入图片说明

I have installed gawk: http://gnuwin32.sourceforge.net/packages/gawk.htm

And added C:\\Program Files (x86)\\GnuWin32\\bin to my Path Environment Variables

Ok so I had to install gawk/awk: http://gnuwin32.sourceforge.net/packages/gawk.htm

Then I updated my Path Environment Variable: 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 --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 PowerShell等效项:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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