A lightweight, efficient file version control system implemented in C++ that allows you to track changes to individual files. This project implements a skip list data structure for efficient version management, providing O(log n) average time complexity for most operations.
- Efficient Version Management: Uses skip list data structure for O(log n) operations
- File Versioning: Track changes to individual files with version numbers
- Version Comments: Add descriptive comments to each version
- Content Preview: View version contents with optional preview mode
- Backup System: Automatic backup of original files
- Command-line Interface: Easy-to-use interactive CLI
-
Skip List Implementation
- Template-based implementation for type flexibility
- Probabilistic balancing for optimal performance
- Average O(log n) complexity for insert, search, and delete operations
-
Version Management
- Automatic version numbering
- Timestamp tracking
- Comment support
- Content storage and retrieval
-
File Operations
- Automatic file backup
- Safe file operations with error handling
- Content verification
- C++17 compatible compiler
- Make sure you have g++ installed
- Clone the repository
- Run the build script:
./build_and_run.shinit <filename>- Initialize version control for a filesave [comment]- Save current state as a new version (optional comment)list [--preview]- List all versions (--preview shows content previews)restore <version>- Restore to a specific version numberview <version>- View the full content of a specific versiondelete <version>- Delete a specific versionlatest- Restore to the latest versionbackup- Restore from original backuphelp- Show help messageexit- Quit the program
# Initialize version control for a file
> init myfile.txt
# Save a new version with comment
> save "Added new feature"
# List all versions
> list
# List versions with content previews
> list --preview
# Restore to a specific version
> restore 2
# View specific version content
> view 2.
├── SkipList.hpp # Skip list data structure implementation
├── Version.hpp # Version class definition
├── FileVersionManager.hpp # Version management implementation
├── main.cpp # CLI implementation
├── build_and_run.sh # Build script
└── README.md # This file
- Maximum level: 16 (suitable for large number of versions)
- Probability factor: 0.5 (balanced performance)
- Space complexity: O(n)
- Average time complexity: O(log n)
- Version number
- Timestamp
- File content
- Optional comment
- Content preview capability
The system includes comprehensive error handling for:
- File operations
- Invalid version numbers
- Memory management
- User input validation
Potential areas for future development:
- Diff viewing between versions
- Branch support
- Network synchronization
- Compression for storage optimization
- GUI interface
Feel free to contribute to this project by:
- Reporting issues
- Suggesting enhancements
- Creating pull requests
This project is open source and available under the MIT License.
Ashish Kaushik
- Inspired by modern version control systems
- Built using efficient data structures and algorithms
- Designed for educational and practical purposes