Optional
Readonly
forceWhen checking out paths from the index, do not fail upon unmerged entries; instead, unmerged entries are ignored.
Optional
Readonly
mergeWhen checking out paths from the index, this option lets you recreate the conflicted merge in the specified paths.
Readonly
pathsThis is used to restore modified or deleted paths to their original contents from the index or replace paths with the contents from a named tree-ish (most often a commit-ish).
One can specify a regular expression for the paths, in such cases, it must be escaped with single-quotes.
For instance checking out a Hello.ts
file will be simply "Hello.ts"
, if one would like to checkout
all TS files, then this for should be used: ts const options = { paths: `'*.ts'` }
.
Optional
Readonly
treeishTree to checkout from. If not specified, the index will be used. git checkout -- ./fileName.ext
.
If you want to get the state from the repository ,use HEAD
which will be equivalent with git checkout HEAD -- ./fileName.ext
.
Options for checking out files from the working tree.
paths
.HEAD
, then setpaths
andtreeish
toHEAD
.HEAD
of a branch, settreeish
tonameOfTheBranch
.treeish
tonameOfTheBranch~2
which will be two commits before the most recent one on the desired branch.