Ge-Git is a lightweight Git implementation in C that mimics Git's internal object storage system, including support for blob, tree, and commit objects.
- β
initβ Initialize a.gegitdirectory - β
hash-objectβ Create blob objects from file content - β
write-treeβ Generate tree objects from directory structure - β
commitβ Create commit objects referencing tree objects - β
Stores all Git-like objects in
.gegit/objects/<sha1>
This project closely follows how Git internally handles content:
| Object Type | Format | Stored In |
|---|---|---|
| Blob | blob <size>\0<content> |
.gegit/objects/<first2>/<rest38> |
| Tree | tree <size>\0<entries> per file |
.gegit/objects/<sha1> |
| Commit | commit <size>\0tree <sha>\nauthor...\n<message> |
.gegit/objects/<sha1> |
Ge-Git/
βββ .gegit/ # Custom .git-like directory for storing objects
β βββ objects/ # Contains all git objects (blobs, trees, commits)
β βββ <hash-prefix>/
β βββ <object-file>
βββ .vscode/ # VS Code settings (optional)
βββ include/ # Header files
β βββ commit.h
β βββ hash_object.h
β βββ init.h
β βββ tree.h
β βββ utils.h
βββ src/ # Source files
β βββ commit.c
β βββ hash_object.c
β βββ init.c
β βββ tree.c
β βββ utils.c
βββ hello.txt # Sample file to hash
βββ main.c # CLI entry point
βββ gegit # Compiled binary
βββ Makefile # Build script
make
./gegit init
π¦ Hash a file as a blob
./gegit hash-object hello.txt
π² Write tree from current directory
./gegit write-tree
π Commit the tree
./gegit commit "initial commit"MIT License Β© Meerthika
