git commit
メッセージを別のテキストファイルに記録するエイリアスを作成しようとしています。ただし、 がgit commit
返さ"nothing to commit (working directory clean)"
れた場合は、別のファイルに何も記録しないでください。
これが私のコードです。git commit
エイリアスは機能します。ファイルへの出力は機能します。ただし、 から何が返されても、メッセージはログに記録されますgit commit
。
function git-commit-and-log($msg)
{
$q = git commit -a -m $msg
$q
if ($q –notcontains "nothing to commit") {
$msg | Out-File w:\log.txt -Append
}
}
Set-Alias -Name gcomm -Value git-commit-and-log
PowerShell 3 を使用しています。