This is a finished Python implementation for the "Build Your Own Git" Challenge. This code implements functionality for all stages (and extensions) of the challenge as of 2025-02-13.
-
init -
cat-file -
hash-object -
ls-tree -
write-tree -
commit-tree(authorandcommitterare hardcoded,messageis not) -
clone
The your_git.sh script is expected to operate on the .git folder inside the
current working directory. If you're running this inside the root of this
repository, you might end up accidentally damaging the repository's .git
folder.
It is recommended to execute your_git.sh in a different folder when running locally.
For example:
mkdir -p /tmp/testing && cd /tmp/testing
/path/to/your/repo/your_git.sh initTo make this easier to type out, you could add a shell alias:
alias mygit=/path/to/your/repo/your_git.sh
mkdir -p /tmp/testing && cd /tmp/testing
mygit initHere's a video of the code being run in the codecrafters test environment: