kit
is a minimal, educational version control system written in modern C++. Inspired by Git, it is designed to help developers learn and explore the internals of version control systems.
-
kit init
– Initialize a repository. -
kit add <file>
– Stage files. -
kit commit
– Commit staged files. -
kit log
– Show commit history. -
kit status
– Show repository status. -
.kit
structure and object storage. -
kit stash
– Temporarily save changes. -
kit branch
– Manage branches. -
kit checkout
– Switch branches. -
kit merge
– Merge branches. -
kit reset
– Reset to a specific commit. -
kit diff
– Show differences between commits or the working directory.
Follow these steps to set up and use kit-vcs
:
-
Clone the repository:
git clone https://github.com/yourusername/kit-vcs.git cd kit-vcs
-
Build the project:
mkdir build && cd build cmake .. make
-
Run the CLI:
./kit-vcs --help
Here are the Git-like commands supported by kit-vcs
:
kit init
– Initialize a new repository.kit add <file>
– Add file(s) to the staging area.kit commit -m <message>
– Commit staged files with a message.kit log
– Show commit history.kit status
– Show the current status of the repository.kit stash
– Stash changes temporarily.kit branch
– Manage branches.kit checkout <branch>
– Switch to a specific branch.kit merge <branch>
– Merge a branch into the current branch.kit reset <commit>
– Reset to a specific commit.kit diff
– Show differences between commits or the working directory.
Here’s an example of how to use kit-vcs
:
kit init
kit add main.cpp
kit commit -m "Initial commit"
kit log
The .kit
directory structure:
.kit/
├── HEAD # Points to the current branch or commit
├── objects/ # Stores file snapshots and commits
├── refs/ # Stores references to branches
│ └── heads/ # Stores branch heads
└── stash/ # Stores stashed changes
- C++17 – Modern C++ for clean and efficient code.
- CMake – Build system for cross-platform compatibility.
- cxxopts – Lightweight CLI parser.
- Filesystem API – For file and directory operations.
- (Future) OpenSSL or Crypto++ – For hashing and encryption.
- Learn Git internals.
- Write a clean version control system.
- Play with low-level file I/O, hashing, and DAGs.
- Create, list, and delete branches.
- Store branch references in
.kit/refs/heads
.
- Switch between branches or specific commits.
- Update the working directory to match the target branch or commit.
- Merge changes from one branch into another.
- Handle conflicts during the merge process.
- Reset the repository to a specific commit.
- Support soft, mixed, and hard resets.
- Show differences between:
- The working directory and the last commit.
- Two specific commits.
- Highlight added, modified, and deleted lines.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Feel free to open issues or submit pull requests to improve kit-vcs
.