此gitk-Linux命令的Windows等效程序
因此: 我想将此Linux命令转换为Windows等效命令,或者此命令对Windows语法正确,但不确定此gitk-Linux命令的Windows等效程序,linux,windows,git,powershell,awk,Linux,Windows,Git,Powershell,Awk,因此: 我想将此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: 在Git Shell上: 这给了我以下错误: 我已经安装了gawk: 并将C:\Pro
$
和
:
gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
我已尝试在我的Windows Git Shell、Powershell和cmd.exe上运行此cmd,其中我的cd
是Git目录,cmd.exe:
在Git Shell上:
这给了我以下错误:
我已经安装了gawk:
并将
C:\Program Files(x86)\GnuWin32\bin
添加到我的路径
环境变量确定,因此我必须安装gawk/awk:
然后我更新了我的Path
环境变量:C:\ProgramFiles(x86)\GnuWin32\bin\
然后我不得不重新启动计算机来刷新环境变量
然后我可以运行gitk cmd,无需任何更改,在Windows计算机上运行良好:
gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
但是它必须在Windows Git Shell中,cmd不能从Windows cmd.exe运行。以下是Windows PowerShell的等效版本:
gitk--all$(git-fsck--no-reflog | Select String“(悬空提交)(.*)”){$.Line.Split(“”)[2]}
为什么要删除awk
位?这很重要。它将git fsk--no-reflog的输出过滤到第三个字段,其中包含悬挂提交的行。这大概就是提交散列。因此,gitk--all
没有得到它不理解的参数。我以为awk是一个仅限Linux的cmd,只是发现了gnuwin32,或者我需要在我的Windows机器上安装“gawk”,在修改路径后是否重新启动了shell(可能还有Windows)?如果他们没有看到更新的路径,他们仍然无法找到awk。但是,命令行中的完整路径应该可以工作。如果要执行gawk
路径,请确保将cmd行从awk
更改为gawk
。祝你好运,谢谢!通过一次吉特克拉肯藏匿点爆炸事故挽救了整整一天的工作损失:)