Skip to content

Instantly share code, notes, and snippets.

@hymkor
Last active October 6, 2025 01:38
Show Gist options
  • Select an option

  • Save hymkor/ea1c3ad29628290cd1c340de12a09710 to your computer and use it in GitHub Desktop.

Select an option

Save hymkor/ea1c3ad29628290cd1c340de12a09710 to your computer and use it in GitHub Desktop.
git にも jj にも登録していないファイルを列挙(.gitignore に含まれているものも表示する)
Set-PSDebug -Strict
$saveEncode = $null
if ([Console]::IsOutputRedirected) {
$saveEncode = [System.Console]::OutputEncoding
[System.Console]::OutputEncoding=[System.Text.Encoding]::UTF8
}
$gitfiles = @{}
git ls-files | ForEach-Object { $gitfiles[ $_ ] = $true }
function ls-r($path){
Get-ChildItem $path -Exclude ".jj",".git" |
ForEach-Object {
if ( $_.Mode -like "d*" ){
ls-r (join-path $path $_.Name)
} elseif ( $_.Mode -notlike "l*" ){
Write-Output `
((join-Path $path $_.Name) `
-Replace "^\.\\","" `
-Replace "\\","/")
}
}
}
ls-R "." | Where-Object { -not $gitfiles.ContainsKey($_) }
if ( $saveEncode -ne $null ){
[System.Console]::OutputEncoding=$saveEncode
}
#gist https://gist.github.com/hymkor/ea1c3ad29628290cd1c340de12a09710
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment