This repo contains an implementation of a few git functionalities for self learning. As it's hosted in github and requires git features by itself, this git will work when invoking git_d.
- Initialize a directory .git_d which would have the data structures that power git persisted in disk.
- Add changes in a file to all of the staged files. If the file did not change since it's last state, will return this output
- Commit all of the staged changes to the working tree.
git_daniel/
├── src/ # Shared source code (all .cpp and .h files)
├── windows/ # CMakeLists.txt for building on Windows
└── unix/ # CMakeLists.txt for building on macOS / Linux
The source code in src/ is shared across platforms. Platform-specific SHA-256
hashing is handled via preprocessor guards in CryptoUtils.cpp (Windows BCrypt,
macOS CommonCrypto, Linux OpenSSL).
Requires C++23.
All commands are run from the repository root.
cmake -S unix -B unix/build -DCMAKE_CXX_COMPILER=clang++
cmake --build unix/build
./unix/build/git_d
Linux note: OpenSSL development headers are required (
libssl-devon Debian/Ubuntu,openssl-develon Fedora/RHEL).
All commands are run from the repository root.
cmake -S windows -B windows/build -G Ninja -DCMAKE_CXX_COMPILER=clang++
cmake --build windows/build
.\windows\build\git_d.exe
Requires the CodeLLDB extension in Cursor/VSCode.
cmake -S unix -B unix/build -DCMAKE_BUILD_TYPE=Debug
- Set a breakpoint by clicking in the gutter next to any line number.
- Open Run & Debug (
Cmd+Shift+D). - Select a configuration from the dropdown (e.g.
Debug: add example) and press F5. - The binary will rebuild automatically then pause at your breakpoint.
| Key | Action |
|---|---|
F10 |
Step over |
F11 |
Step into |
Shift+F11 |
Step out |
F5 |
Continue |
To debug a different command or arguments, edit "args" in .vscode/launch.json.