A simple implementation of Git in TypeScript.
- init
- add
- rm
- commit
- branch
- checkout
- diff
- remote
- fetch
- merge
- pull
- push
- status
- clone
At a bare minimum, a .git repository should contain the following files and dirs:
- .git
- objects/
- refs/
- HEAD
- configBlobs are used to store file data. Blobs only store the contents of a file,
not its name or permissions. All Git objects are identifiable by a 40-character
SHA-1 hash, also known asthe "object hash". Example of an object hash: e88f7a929cd70b0274c4ea33b209c97fa845fdbc
Each Git Blob is stored inside the .git/objects directory.
This command shows the type of an object, it's size and it's content. Example usage:
$ git cat-file -p <blob_sha>
hello world # This is the contents of the blobTodo:
- Read the contents of the blob object file from the
.git/objectsdirectory - Decompress the contents using Zlib
- Extract the actual "content" from the decompressed data
- Print the content to stdout