🦖 Rex — A Simple Git-like Version Control System
Rex is a lightweight, Git-inspired version control system built in Python. It implements core version control concepts such as blobs, trees, commits, branching, and checkout — helping you understand how Git works internally.
⸻
🚀 Features
- Initialize a repository (init)
- Track files and directories (add)
- Create commits with history tracking (commit)
- View commit history (log)
- Switch branches or commits (checkout)
- Branch creation support
- Object storage using SHA-1 hashing
- Compression using zlib (just like Git!)
⸻
🧠 How It Works
Rex mimics Git’s internal architecture:
- Blob → Stores file content
- Tree → Represents directory structure
- Commit → Tracks snapshots with metadata
- Objects → Stored using SHA-1 hashes
- Index → Tracks staged files
- HEAD → Points to current branch/commit
All data is stored inside a hidden .rex/ directory.
📦 Installation
git clone https://github.com/lieutenant-Rohit/rex.git
cd rex
python3 --version
python3 rex.py
chmod +x rex.py ./rex.py
🔍 Example Usage
./rex.py init
echo "Hello Rex" > file.txt
./rex.py add file.txt
./rex.py commit -m "First commit"
./rex.py log
./rex.py checkout feature --create
echo "New change" >> file.txt
./rex.py add file.txt ./rex.py commit -m "Updated file"
./rex.py checkout master