resetIndex
Reset a file in the git index (aka staging area)
param | type [= default] | description |
---|---|---|
fs | FsClient | a file system client |
dir | string | The working tree directory path |
gitdir | string = join(dir, '.git') | The git directory path |
filepath | string | The path to the file to reset in the index |
ref | string = 'HEAD' | A ref to the commit to use |
cache | object | a cache object |
return | Promise<void> | Resolves successfully once the git index has been updated |
Note that this does NOT modify the file in the working directory.
Example Code:
await git.resetIndex({ fs, dir: '/tutorial', filepath: 'README.md' })
console.log('done')
Tip: If you need a clean slate, expand and run this snippet to clean up the file system.
window.fs = new LightningFS('fs', { wipe: true })
window.pfs = window.fs.promises
console.log('done')