Skip to main content

Get-VSTeamGitCommit

SYNOPSIS

Retrieve git commits for a project

SYNTAX

All (Default)

Get-VSTeamGitCommit -RepositoryID <Guid> [-FromDate <DateTime>] [-ToDate <DateTime>]
[-ItemVersionVersionType <String>] [-ItemVersionVersion <String>] [-ItemVersionVersionOptions <String>]
[-CompareVersionVersionType <String>] [-CompareVersionVersion <String>]
[-CompareVersionVersionOptions <String>] [-FromCommitId <String>] [-ToCommitId <String>] [-Author <String>]
[-ItemPath <String>] [-Top <Int32>] [-Skip <Int32>] [-User <String>] [-ProjectName <String>]
[<CommonParameters>]

ItemPath

Get-VSTeamGitCommit -RepositoryID <Guid> [-FromDate <DateTime>] [-ToDate <DateTime>]
[-ItemVersionVersionType <String>] [-ItemVersionVersion <String>] [-ItemVersionVersionOptions <String>]
[-CompareVersionVersionType <String>] [-CompareVersionVersion <String>]
[-CompareVersionVersionOptions <String>] [-FromCommitId <String>] [-ToCommitId <String>] [-Author <String>]
-ItemPath <String> [-ExcludeDeletes] [-Top <Int32>] [-Skip <Int32>] [-HistoryMode <String>] [-User <String>]
[-ProjectName <String>] [<CommonParameters>]

ByIds

Get-VSTeamGitCommit -RepositoryID <Guid> [-Id <String[]>] [-ProjectName <String>] [<CommonParameters>]

CompareVersion

Get-VSTeamGitCommit -RepositoryID <Guid> [-FromDate <DateTime>] [-ToDate <DateTime>]
[-ItemVersionVersionType <String>] [-ItemVersionVersion <String>] [-ItemVersionVersionOptions <String>]
-CompareVersionVersionType <String> -CompareVersionVersion <String> [-CompareVersionVersionOptions <String>]
[-FromCommitId <String>] [-ToCommitId <String>] [-Author <String>] [-Top <Int32>] [-Skip <Int32>]
[-User <String>] [-ProjectName <String>] [<CommonParameters>]

ItemVersion

Get-VSTeamGitCommit -RepositoryID <Guid> [-FromDate <DateTime>] [-ToDate <DateTime>]
-ItemVersionVersionType <String> -ItemVersionVersion <String> [-ItemVersionVersionOptions <String>]
[-CompareVersionVersionType <String>] [-CompareVersionVersion <String>]
[-CompareVersionVersionOptions <String>] [-FromCommitId <String>] [-ToCommitId <String>] [-Author <String>]
[-Top <Int32>] [-Skip <Int32>] [-User <String>] [-ProjectName <String>] [<CommonParameters>]

DESCRIPTION

The Get-VSTeamGitCommit function gets the commits for a git repository.

EXAMPLES

Example 1

Get-VSTeamGitCommit -ProjectName demo -RepositoryId 118C262F-0D4C-4B76-BD9B-7DD8CA12F196

This command gets a list of all commits in the demo project for a specific repository.

Example 2

Get-VSTeamGitRepository | Select-Object -First 1 | Get-VSTeamGitCommit

This command gets the Repository Id from the pipeline and the project name from the default project.

PARAMETERS

-FromDate

If provided, only include history entries created after this date (string)

Type: DateTime
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ToDate

If provided, only include history entries created before this date (string)

Type: DateTime
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ItemVersionVersionType

Version type (branch, tag, or commit). Determines how Id is interpreted. The acceptable values for this parameter are:

  • branch
  • commit
  • tag
Type: String
Parameter Sets: All, ItemPath, CompareVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: String
Parameter Sets: ItemVersion
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ItemVersionVersion

Version string identifier (name of tag/branch, SHA1 of commit)

Type: String
Parameter Sets: All, ItemPath, CompareVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: String
Parameter Sets: ItemVersion
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ItemVersionVersionOptions

Version options - Specify additional modifiers to version (e.g Previous). The acceptable values for this parameter are:

  • firstParent
  • none
  • previousChange
Type: String
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CompareVersionVersionType

Version type (branch, tag, or commit). Determines how Id is interpreted. The acceptable values for this parameter are:

  • branch
  • commit
  • tag
Type: String
Parameter Sets: All, ItemPath, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: String
Parameter Sets: CompareVersion
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CompareVersionVersion

Version string identifier (name of tag/branch, SHA1 of commit). The acceptable values for this parameter are:

  • firstParent
  • none
  • previousChange
Type: String
Parameter Sets: All, ItemPath, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: String
Parameter Sets: CompareVersion
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CompareVersionVersionOptions

Version options - Specify additional modifiers to version (e.g Previous)

Type: String
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-FromCommitId

If provided, a lower bound for filtering commits alphabetically

Type: String
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ToCommitId

If provided, an upper bound for filtering commits alphabetically

Type: String
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Author

Alias or display name of the author

Type: String
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Id

If provided, specifies the exact commit ids of the commits to fetch. May not be combined with other parameters.

Type: String[]
Parameter Sets: ByIds
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ItemPath

Path of item to search under

Type: String
Parameter Sets: All
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: String
Parameter Sets: ItemPath
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ExcludeDeletes

Only applies when an itemPath is specified. This determines whether to exclude delete entries of the specified path.

Type: SwitchParameter
Parameter Sets: ItemPath
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Top

Maximum number of entries to retrieve

Type: Int32
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Skip

Number of entries to skip

Type: Int32
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-HistoryMode

What Git history mode should be used. This only applies to the search criteria when Ids = null and an itemPath is specified. The acceptable values for this parameter are:

  • firstParent
  • fullHistory
  • fullHistorySimplifyMerges
  • simplifiedHistory
Type: String
Parameter Sets: ItemPath
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-User

Alias or display name of the committer

Type: String
Parameter Sets: All, ItemPath, CompareVersion, ItemVersion
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProjectName

Specifies the team project for which this function operates.

You can tab complete from a list of available projects.

You can use Set-VSTeamDefaultProject to set a default project so you do not have to pass the ProjectName with each call.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-RepositoryID

The id or friendly name of the repository. To use the friendly name, projectId must also be specified.

Type: Guid
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

You can pipe a repository ID to this function.

Prerequisites:

Set the account and version that all calls will use with Set-VSTeamAccount. Default version sets to API version 3.0 (TFS2017) if not manually set.

tips:

  • check called version of the API with Get-VSTeamAPIVersion or Get-VSTeamInfo
  • use Set-VSTeamDefaultProject to set default project for every call
  • use Set-VSTeamDefaultAPITimeout to change the default timeout of 60 seconds for all calls.
  • use Profiles to load an account and the correct version