Bubble Git is a lightweight, custom implementation of a version control system inspired by Git. It is built from scratch, focusing on the fundamental internals of how Git works.
Currently, the implementation is written in Python, with plans to rewrite it in Rust for improved performance and safety. This project is a learning and exploratory tool for understanding Git's internals, providing insight into how hashing, trees, and basic version control operations work.
The following commands are currently available in Bubble Git:
init: Initializes a new Bubble Git repository.hash-object: Computes the SHA-1 hash of a file and stores it in the Bubble Git object database.cat-file: Reads and outputs the contents of a Git object stored in the database.write-tree: Generates a tree object representing the current directory structure.read-tree: Reads a tree object and restores the directory structure in the working directory.
The following features are under development:
commit: Record changes to the repository.log: Display the commit history.branch: Manage branches within the repository.checkout: Switch between branches or commits.
To run the Python implementation of Bubble Git, ensure you have:
- Python 3.8 or later
pipfor managing Python packages
To set up Bubble Git locally, clone the repository and install it in editable mode:
# Clone the repository
git clone https://github.com/your-repo/bubble-git.git
cd py-impl
#Start the virtual environment
source bin/activate
# Install in editable mode
pip3 install -e .The -e or --editable flag installs the package in a way that links the source code directory directly to your Python environment. This is especially useful during development, as it allows any changes you make to the source code to be immediately reflected when running the commands, without needing to reinstall the package.
After installing Bubble Git, you can use it by running the following commands in the terminal:
-
Initialize:
bubble-git init
-
Hash a file and store its object:
bubble-git hash-object <file>
-
Read an object:
bubble-git cat-file <object-hash>
-
Write the directory tree to a tree object:
bubble-git write-tree
-
Read a tree object and restore the directory structure:
bubble-git read-tree <tree-hash>
For planned commands like commit, log, branch, and checkout, stay tuned for updates!
- Implement the remaining Git-like commands (
commit,log,branch,checkout). - Rewrite the entire implementation in Rust for better performance.
- Add comprehensive tests and documentation.