Skip to content

AyushKashyapII/Git_Local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🐍 PyGit β€” A Git Clone in Python

PyGit is a custom implementation of the Git version control system, built from scratch in Python.
This project is an educational tool designed to explore and understand the core mechanics of Git, including its object model, staging area (index), branching, and command-line interface.

PyGit demonstrates how Git’s powerful features are built upon a few simple and elegant concepts.


✨ Features

This version of PyGit implements the core plumbing and porcelain commands that cover the majority of a local, single-developer workflow.

πŸ“ Repository Management

  • init β€” Initialize a new, empty PyGit repository

πŸ“¦ File Tracking & Staging

  • add β€” Add file contents to the index (staging area)
    • Recursively adds files in directories

πŸ•° History & Snapshots

  • commit β€” Create a new commit from staged files
  • log β€” View commit history (newest to oldest)

🌿 Branching & Navigation

  • branch β€” List all local branches or create a new branch
  • checkout β€” Switch between branches or restore a specific commit

πŸ” Inspection & Comparison

  • status β€” Show the status of the working directory and staging area
  • diff β€” Show line-by-line differences between working directory and index
  • cat-file β€” Inspect any object (commit, tree, or blob) by its hash

🧠 How Git Works (The PyGit Model)

PyGit is built on the same fundamental principles as Git.

πŸ—„ Object Database (.pygit/objects)

Everything in PyGit is stored as an object, identified by a unique SHA-1 hash computed from its contents.
This makes the database content-addressable and immutable.

Object Types

  • Blob β€” Stores the raw content of a file
  • Tree β€” Represents a directory containing blobs and subtrees
  • Commit β€” A snapshot of the project at a specific point in time
    Includes:
    • Root tree hash
    • Parent commit(s)
    • Author and commit message

πŸ“Œ Index (.pygit/index)

Also known as the staging area, the index maps file paths to blob hashes that will be included in the next commit.

About

Working Kind of git clone built from scratch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages