---
title: "Checkout-Code"
---
Gets source code from a branch or commit on a git repository.
Git::Checkout-Code(
[BranchOrCommit: <text>],
[To: <text>],
[RecurseSubmodules: <true/false>],
[CommitHash: <text>],
[PreserveLastModified: <true/false>],
[WriteMinimalGitData: <true/false>],
[From: <text>],
[UserName: <text>],
[Password: <text>],
[RepositoryUrl: <text>]
);
| Name | Format | Script Usage | Usage Notes |
|---|---|---|---|
| Commit or branch | text | BranchOrCommit | Default value is "$Commit". |
| To | text | To | Default value is "$WorkingDirectory". |
| Recurse submodules | true/false | RecurseSubmodules | Default value is "True". |
| ⇒ Commit hash | text | CommitHash | The full SHA1 hash resolved commit will be stored in this variable. This is useful when you specify a branch for the BranchOrCommit property. |
| Preserve Last Modified Date | true/false | PreserveLastModified | By default, Git will not set the Last Modified date of files when checking out. Selecting this option may take additional time, depending on the number of files in the repository. |
| Write minimal git data | true/false | WriteMinimalGitData | Writes minimal information to the .git directory in the output directory which contains the head commit and the origin url. |
| Repository connection | text | From | Default value is "$Repository". |
| User name | text | UserName | Value note: "Username from repository connection". |
| Password | text | Password | Value note: "Password from repository connection". |
| Repository URL | text | RepositoryUrl | Value note: "Repository URL from repository connection". |