Last active
August 6, 2021 19:18
-
-
Save simshaun/a93de5c4b775e0c042fea0015fd52ee7 to your computer and use it in GitHub Desktop.
PowerShell git skip-worktree aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Command: gitskipped | |
Description: List skipped files in git | |
Usage: gitskipped | |
#> | |
function gitskipped { | |
(git ls-files -v $args) -split "\r\n" | Select-String -Pattern '^S ' | ForEach-Object { | |
Write-Output $_.Line.Substring(2) | |
} | |
} | |
<# | |
Command: gitskip | |
Description: Mark file(s) as "skip-worktree" in git | |
Usage: gitskip .env | |
#> | |
function gitskip { | |
git update-index --skip-worktree $args | |
} | |
<# | |
Command: gitunskip | |
Description: Unmark file(s) as "skip-worktree" in git | |
Usage: gitunskip .env | |
#> | |
function gitunskip { | |
git update-index --no-skip-worktree $args | |
} | |
<# | |
Command: gitunskipall | |
Description: Unmark all skipped files in git | |
Usage: gitunskipall | |
#> | |
function gitunskipall { | |
$files = @((git ls-files -v $args) -split "\r\n" | Select-String -Pattern '^S ' | ForEach-Object { $_.Line.Substring(2) }) | |
git update-index --no-skip-worktree $files | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment