npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sarabjeet_sgit

v1.0.0

Published

Sgit is a lightweight, custom version control system designed to mimic the core functionalities of Git. It enables you to track changes to files, stage them, and commit them with ease, offering basic functionality like logging commits and displaying diffe

Downloads

6

Readme

Sgit - A Simple Version Control System

Sgit is a lightweight, custom version control system designed to mimic the core functionalities of Git. It enables you to track changes to files, stage them, and commit them with ease, offering basic functionality like logging commits and displaying differences between file versions.

Features

  • Initialize a new repository with a .Sgit directory
  • Add files to the staging area
  • Commit changes with a message
  • Log commit history
  • Show diffs between committed versions
  • Status of staged files

Installation

Clone this repository and navigate to the directory:

git clone https://github.com/Sarabjeet31/Version-control.git
cd sgit

Install the necessary dependencies using npm:

npm install

Usage

Initialize a repository

To initialize a new Sgit repository in the current directory:

npx sgit init

This creates a .Sgit directory, which will store all objects and commit information.

Add files

To add a file to the staging area:

npx sgit add <filename>

Example:

npx sgit add sample.txt

Commit changes

After staging files, commit them with a message:

npx sgit commit "Your commit message"

Example:

npx sgit commit "Initial commit"

View commit log

To view the commit history:

npx sgit log

Show differences

To see the changes between the current commit and the previous one:

npx sgit show <commitHash>

Example:

npx sgit show 7b9d7266145f34073d310f02d42568c6c3213bb4

Check staged files status

To check the status of the staged files:

npx sgit status

How It Works

  • init: Creates a .Sgit directory that contains an objects folder for storing file contents and commits.
  • add: Reads the content of the file, generates a SHA1 hash, and stores it in the objects directory. Updates the index with the file’s hash.
  • commit: Creates a commit object that references the current state of the files, with a commit message and the parent commit (if any).
  • log: Displays a history of all commits made in the repository.
  • show: Displays the diff between the current commit and its parent (if available).
  • status: Displays the status of staged files with their respective hashes.

Dependencies

  • Commander - For handling command-line input.
  • Chalk - For colored terminal output.
  • Diff - For displaying file differences.
  • Crypto - For generating SHA1 hashes.