我想在powershell中生成一个git命令。
在外壳中,我使用了一个";grep";命令中的功能:
git branch -r --merged | grep -v HEAD
我的powershell脚本看起来像:
$Params = @(
"branch",
"-r",
"--merged"
)
& git $Params
如何在PowerShell中实现grep函数?
只需将-Notmatch
与Select-String
:一起使用
& git $Params | Select-String -NotMatch "HEAD"
试试这个
git $Params | Select-String "HEAD"
有关更多信息,请参阅选择字符串