Skip to content

Zone-Infinity/well-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

well-git

Note:
The clone command in this project uses the git2 crate (libgit2).
Implementing the full Git smart HTTP protocol + packfile parsing turned out to be way bigger than expected during the challenge, so I delegated that part to libgit2.

Everything else here was implemented manually.


Well… it's Git.

This is a small Rust project where I rebuilt parts of Git while doing the
Codecrafters Build Your Own Git challenge:

https://app.codecrafters.io/courses/git/overview

The goal was to understand how Git actually works internally instead of just using it.


What works

These commands are implemented:

init
hash-object
cat-file
ls-tree
write-tree
commit-tree
clone

The core Git pieces are implemented:

blob   → file contents
tree   → directories
commit → snapshots of the project

Objects are stored in .git/objects using SHA-1 hashes, just like real Git.


Running

cargo run -- init
cargo run -- hash-object -w file.txt
cargo run -- cat-file -p <hash>
cargo run -- write-tree
cargo run -- ls-tree --name-only <tree_sha>
cargo run -- commit-tree <tree_sha> -m "message"
cargo run -- clone <repo_url> <directory>

Why this project exists

Mostly curiosity.

Git looks magical until you realize it's basically storing snapshots of files using hashes.

Rebuilding parts of it was a fun way to understand what actually happens inside .git.


Well… it's Git.

About

codecrafters git challenge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors