2 min read
Version Control (in Python)

A lightweight version control written in python.

This was my first finished project ever. Wrote this in the summer of 2024.

There were 3 goals with this project:

  • completion
  • understand how version control systems work
  • learn how Python packaging and distribution works

Wrote a blog post diving deep into the implementation.

Features

  • Initialize a new repository
  • Add files to version control
  • Show status of untracked and modified files
  • Commit changes with messages
  • Show commit history
  • View differences between current files and last commit

Installation

Clone the repository:

git clone https://github.com/OmKharade/pyvcs.git
cd pyvcs

Install the package:

pip install -e .

Usage

# Transform the current directory into a PyVCS repository:
pyvcs init

# Create an empty repository in a new subdirectory
pyvcs init <directory>

# Add a file to version control:
pyvcs add filename.txt

# Commit changes:
pyvcs commit "Commit Message"

# View the status of the working directory. Track Changes
pyvcs status

# View commit history
pyvcs log

# View differences:
pyvcs diff filename.txt

Project Structure

pyvcs/
├── pyvcs/
│   ├── __init__.py
│   └── core.py
├── cli.py
├── setup.py
└── README.md