Welcome to my Rust-based implementation of Git, built as part of the "Build Your Own Git" Challenge on CodeCrafters.io.
This project is an opportunity to explore the inner workings of Git, one of the most widely used version control systems in software development. Throughout this challenge, I’ve implemented a simplified version of Git from scratch using Rust, focusing on core functionalities such as:
- Initializing a Git repository (
.git
directory) - Handling blob objects (create and read)
- Handling tree objects (create and read)
- Creating commits
- Cloning a public GitHub repository
By the end of the challenge, my Git implementation will be capable of performing many fundamental Git operations. This has been an excellent learning experience in both Rust programming and Git internals.
I have successfully completed 6 out of 7 stages in the challenge. Below are the key stages:
- Initialize the .git directory - ✅
- Read a blob object - ✅
- Create a blob object - ✅
- Read a tree object - ✅
- Write a tree object - ✅
- Create a commit - ✅
- Clone a repository - In Progress
Each step has deepened my understanding of the way Git operates under the hood, especially how it manages and stores different objects (blobs, trees, commits) and the challenges related to handling them efficiently in Rust.
You can experiment with this project locally. The entry point is located in src/bin/git.rs
. Here's how you can get started:
-
Ensure you have cargo (>=1.80) installed.
-
Build and run the project with the following commands:
cargo build cargo run -- init
-
You can also use the option
-h
or--help
to get more detailed documentation and usage information:cargo run -- -h
-
To avoid any accidental changes to your Git repository during local testing, it’s recommended to test the program in a separate directory:
mkdir -p /tmp/testing && cd /tmp/testing cargo run -- init
For safety, execute the program in a different folder to prevent modifying the .git
folder of this project:
mkdir -p /tmp/testing && cd /tmp/testing
cargo run -- init
- Completing the final step: Cloning a repository
- Adding more test cases to ensure the robustness of the implementation
- Improving the error handling and performance of the Rust code
- Rust: The core programming language used to build the project
- Git: The system being implemented
- CodeCrafters.io: The platform providing the challenge
Feel free to explore, or reach out for any questions!