Skip to content

Files

Latest commit

345b559 · Oct 4, 2023

History

History
29 lines (17 loc) · 1011 Bytes
·

init.md

File metadata and controls

29 lines (17 loc) · 1011 Bytes
·

Command: init

Usage

# Using ts-node
npx ts-node <path/to/git.ts> init [directory]

# Using node
node <path/to/git.js> init [directory]

Options

  • directory

    The directory where the init command will be executed. If this directory does not exist, it will be created.

Description

This command created an empty Git repository or reinitialize an existing one.

Refer to this official doc for more information about the .git directory.

Approach

  1. Added support for the command through git.ts. The code for init command is present in init.ts.

  2. Created a separate folder default-file that contains some of the files required as per the Git protocol. The contents of these files are copied to the .git directory. To ensure that these folder is also copied to the build dir, I updated the build script present in package.json