A minimal, educational implementation of core Git features in Python.
This project is a personal learning exercise, inspired by Ben Hoyt's "Build Your Own Git in Python". It implements a subset of Git's functionality, including repository initialization, object storage, staging, committing, status, diff, and pushing to a remote repository.
The code is written for clarity and educational purposes, not for production use.
- Initialize a new repository (
init
) - Add files to the index (
add
) - Commit staged changes (
commit
) - Show repository status (
status
) - Show diffs between index and working copy (
diff
) - List files in the index (
ls-files
) - Display object contents and info (
cat-file
) - Hash file contents as Git objects (
hash-object
) - Push commits to a remote repository (
push
)
Run commands using the pygit.py
script:
python pygit.py init myrepo
cd myrepo
echo "hello" > hello.txt
python pygit.py add hello.txt
python pygit.py commit -m "Initial commit"
python pygit.py status