Skip to content

danardiello/local-version-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vcs — a small local version control (learning project)

About

vcs is a small, local version control system I built to practice modern C++.

Disclaimer This is a learning project. It is not intended for production use and may not be actively maintained.

Features:

  • Local repository initialization
  • Stage files for commit
  • Create commits with complete file snapshots
  • View commit history
  • Switch to previous commits

Intentional limitations:

  • No network functionality
  • No diff algorithms
  • No branches or merging
  • No compression or delta storage
  • Non-cryptographic hashing (deterministic FNV-1a; local use only)
  • Custom Base64 implementation (minimal; not designed for adversarial input)

Project Structure

vcs/
├── CMakeLists.txt             # Build configuration
├── README.md                  # This document
├── include/vcs/               # Public header files
│   ├── cli/                   # Command-line interface
│   ├── core/                  # Core domain logic
│   ├── storage/               # Storage and filesystem
│   └── utils/                 # Utility functions
├── src/                       # Implementation files
│   ├── cli/                   # CLI implementation
│   ├── core/                  # Core implementation
│   ├── storage/               # Storage implementation
│   ├── utils/                 # Utils implementation
│   └── main.cpp               # Program entry point
└── tests/                     # Unit tests

Layers

  1. CLI: Parses arguments and calls into the core layer
  2. Core: Repository operations and data types (Repository, Commit, Index)
  3. Storage: Filesystem and on-disk layout (.vcs, objects)
  4. Utils: Logging, errors, hashing

Requirements

  • CMake 3.20 or higher
  • C++20 compatible compiler (GCC 11+, Clang 14+, or MSVC 2019+)
  • Git (for cloning the repository)

Build Instructions

# Configure and build
cmake -S . -B build
cmake --build build

# Run executable
./build/vcs help

Usage

The following commands assume that the vcs executable is available in the build directory or in PATH.

# Initialize repository
vcs init

# Add files or directories to staging area (recursive)
vcs add file.txt
vcs add src/
vcs add .

# Create commit
vcs commit "First version"

# Show history
vcs log

# Switch to a commit, tracked files are synced; tracked files missing in target are removed; untracked stay
vcs checkout <commit-hash>

Testing

Unit tests use Catch2 and run via CTest.

# Run tests
ctest --test-dir build

Documentation

The generated Doxygen docs are published via GitHub Pages:

Contributing

This is a learning project. Feedback is welcome, but the project may not be actively maintained.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

Local version control system in modern C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published