Reputation: 19222
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
Upvotes: 1
Views: 2965
Reputation: 5167
Here is the Windows PowerShell equivalent:
gitk --all $(git fsck --no-reflog | Select-String "(dangling commit )(.*)" | %{ $_.Line.Split(' ')[2] })
Upvotes: 2
Reputation: 19222
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.
Upvotes: 1