init
Initialize a new repository
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 |
bare | boolean = false | Initialize a bare repository |
defaultBranch | string = 'master' | The name of the default branch (might be changed to a required argument in 2.0.0) |
return | Promise<void> | Resolves successfully when filesystem operations are complete |
Example Code:
await git.init({ fs, dir: '/tutorial' })
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')