A simplistic git implementation in Python3!
Git is the most widely used version control system, and this is my shot at implementing at least the basic functionality. I built this with Python3 with OOP principles in mind, following simplistic git internals.
Credit goes to Boot Dev for their courses on Python, OOP, and functional programming.
./install.sh
source ~/.bashrc # or restart terminal
# Run the comprehensive Python demo with colorful output
python3 demo.py
# Or try the quick bash demo
./quick-demo.sh
NOTE: Add this to your IDE's workspace settings to visualize the git folders:
{
"files.exclude": {
"**/.git": false,
"**/.minigit": false
}
}
minigit init
- Initialize a new repositoryminigit add <file>
- Stage files for commitminigit commit -m "message"
- Create a commit with staged changesminigit status
- Show working directory status and staged filesminigit log
- Display commit historyminigit cat-file -p <hash>
- Inspect git objects by hashminigit move u
- Traverse up to parent commitminigit move d
- Traverse down to child commitminigit checkout <commit-hash>
- Jump to a specific commit
Object Inspection: Use cat-file -p
to examine the internal structure of commits, trees, and blobs.
Commit Navigation: The move u/d
commands let you traverse the commit history interactively without checking out each commit.
Branching, merging, and checkout to branches are not yet implemented and will be added in future versions.
blog.md
- Detailed code implementation walkthroughgit-research.md
- Deep dive into git internals (researched with Gemini 2.5 Pro)
Contributions are welcome! Feel free to open issues or submit pull requests.