2013-01-14 37 views
1

我想能够使用Windows PowerShell命令GET-ChildItem执行git的状态

Get-ChildItem -include .git -Force -Recurse | ?{ $_.PSIsContainer -and $_.Attributes -match "Hidden"} 

,并为每一个“记录”发现并输出到一个文本文件执行git status

这样我就可以得到我的异步更改报告。

有没有办法做到这一点?

+0

你究竟想要达到什么目的?这似乎是有点长途跋涉 –

+0

看看'坑' - https://github.com/manojlds/pit。它试图解决你正在做的事情。谨慎提出您的具体使用案例的问题,我们可以做到这一点? – manojlds

+0

你对此有何看法? Get-ChildItem -include .git -Force -Recurse | ?{$ _。PSIsContainer和$ _。Attributes -match“Hidden”} | foreach-object {$ a = Get-Location; cd $ _。parent.fullname;获取地点; git状态; cd $ a;} – JudgeProphet

回答

0

最后,我将在我的配置文件中为此命令设置一个别名。

Get-ChildItem -include .git -Force -Recurse | ?{ $_.PSIsContainer -and $_.Attributes -match "Hidden"} | foreach-object {$a=Get-Location; cd $_.parent.fullname; Get-Location; git status; cd $a;}