linux - Windows 等效于此 gitk Linux 命令

标签 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 外壳上:

enter image description here

这给了我以下错误:

enter image description here

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

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

最佳答案

这是等效的 Windows PowerShell:

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

关于linux - Windows 等效于此 gitk Linux 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30877535/

相关文章:

linux - vim-按箭头键给出 'after'

c - 如何在C中同时获取输入和打印内容

c++ - 获取win7当前使用的堆栈大小

linux - gitolite 包不创建用户

git - git 如何将当前分支推送到另一个远程/源?

c - 如何获得 tcp 套接字的当前 RTT 估计?

python - 使用 boto3 挂载 EBS 卷

linux - 如何从 if 条件中获取输出?

windows - windows服务器安装mongodb社区版失败

Git Push 从另一个存储库提交,没有原始用户信息