Gets information about all added, untracked, and modified files in a repository.
Get-GitRepositoryStatus [[-Path] <String>] [-IncludeIgnored] [-RepoRoot <String>] [<CommonParameters>]
Get-GitRepositoryStatus commands gets information about which files in your working directory are new, untracked, or modified, including files that have been staged for the next commit. It gets information about each uncommitted change in your repository.
Ignored items are not returned unless you provide the
You can get status for specific files and directories with the Path parameter. If you provide a
RepoRoot parameter to work with a specific repository, the values of the
Path parameter should be relative to the root of that repository. With no
RepoRoot parameter, the paths in the
Path parameter are treated as relative to the current directory. Wildcards are supported and are passed directly to Git to evaluate (i.e. use Git wildcard syntax not PowerShell's).
LibGit2Sharp.StatusEntry objects returned have several extended type data members added. You should use these members instead of using the object's
$trueif the item has been staged for the next commit;
$trueif the item is new in the working directory or has been staged for the next commit;
$trueif the item was merged and currently has conflicts;
$trueif the item was deleted from the working directory or has been staged for removal in the next commit;
$trueif the item is ignored;
$falseotherwise. You'll only see ignored items if you use the
$trueif the item is modified;
$trueif the item was renamed;
$trueif the item's type was changed;
$trueif the item is unchanged;
$trueif the item is unreadable;
$trueif the item is untracked (i.e. hasn't been staged or added to the repository);
When displayed in a table (the default), the first column will show characters that indicate the state of each item, e.g.
State FilePath ----- -------- a LibGit2\Formats\LibGit2Sharp.StatusEntry.ps1xml a LibGit2\Functions\Get-GitRepositoryStatus.ps1 m LibGit2\LibGit2.psd1 a LibGit2\Types\LibGit2Sharp.StatusEntry.types.ps1xml a Tests\Get-GitRepositoryStatus.Tests.ps1
The state will display:
iif the item is ignored (i.e.
aif the item is untracked or staged for the next commit (i.e.
mif the item was modified (i.e.
dif the item was deleted (i.e.
rif the item was renamed (i.e.
tif the item's type was changed (i.e.
?if the item can't be read (i.e.
!if the item was merged with conflicts (i.e.
If no state characters are shown, the file is unchanged (i.e.
This function implements the
git status command.
|Name||Type||Description||Required?||Pipeline Input||Default Value|
The path to specific files and/or directories whose status to get. Git-style wildcards are supported.
Return ignored files and directories. The default is to not return them.
The path to the repository whose status to get.
Demonstrates how to get the status of any uncommitted changes for the repository in the current directory.
Get-GitRepositoryStatus -RepoRoot 'C:\Projects\LibGit2.PowerShell'
Demonstrates how to get the status of any uncommitted changes for the repository at a specific location.
Get-GitRepositoryStatus -Path 'build.ps1','*.cs'
Demonstrates how to get the status for specific files at or under the current directory using the Path parameter. In this case, only modified files named
build.ps1 or that match the wildcard
*.cs under the current directory will be returned.
Get-GitRepositoryStatus -Path 'build.ps1','*.cs' -RepoRoot 'C:\Projects\LibGit2.PowerShell`
Demonstrates how to get the status for specific files under the root of a specific repository. In this case, only modified files named
build.ps1 or that match the wildcard
C:\Projects\LibGit2.PowerShell will be returned.