pit-vcs
v1.0.2
Published
A lightweight version control system inspired by Git.
Downloads
181
Maintainers
Readme
Pit - A Lightweight Version Control System 🚀
Pit is a simple version control system inspired by Git. It lets you track changes, commit updates, and view the history of your project. Perfect for learning how version control works or managing simple projects without the complexity of Git.
✨ Features
- 🏁 Initialize a Repository: Create a
.pit
directory to track files. - 📂 Staging Area: Add files to a staging area before committing.
- 💾 Commit Changes: Save the state of your files with a message.
- 📜 View History: View a log of all commits.
- 🔍 Show Differences: View file changes between commits.
🔧 Installation
Using npm (Recommended)
Install Pit globally using npm:
npm install -g pit
Clone from GitHub
Alternatively, clone the repository and link it globally:
git clone https://github.com/your-username/pit.git
cd pit
npm install
npm link
🚀 Usage
Pit provides a set of commands to manage your repository:
1. Initialize a Repository
Create a .pit
directory in your project:
pit init
2. Add Files to Staging
Add files to the staging area:
pit add <file>
Example:
pit add sample.txt
3. Commit Changes
Save the state of your files with a message:
pit commit "<message>"
Example:
pit commit "Initial commit"
4. View Commit History
Display the log of all commits:
pit log
5. Show Differences
View file changes in a specific commit:
pit show <commitHash>
📖 Example Workflow
# Initialize a repository
pit init
# Add a file
pit add file.txt
# Commit changes
pit commit "Add file.txt"
# View commit history
pit log
# Show changes in a commit
pit show <commitHash>
⚙️ How It Works
- .pit Directory: All tracked files, commits, and metadata are stored in a
.pit
directory at the project root. - Staging Area: Changes are staged in an
index
file within.pit
before committing. - Commits: Each commit is stored as a file in
.pit/objects
with metadata, a message, and file contents.
🛠 Development
Prerequisites
- Node.js (v16+ recommended)
Install Dependencies
Run the following to install dependencies:
npm install
Run Locally
Test commands directly using:
node index.js <command>
🤝 Contributing
Contributions are welcome! Follow these steps to contribute:
- Fork this repository.
- Create a branch (`git checkout -b feature/my-feature`).
- Commit your changes (`git commit -m "Add feature"`).
- Push to your branch (`git push origin feature/my-feature`).
- Create a Pull Request.
📜 License
This project is licensed under the MIT License.
🙏 Acknowledgements
- Inspired by Git.
- Uses helpful packages like:
📞 Contact
For questions or support, feel free to reach out:
- Name: Vivek Tarun
- Email: [email protected]
- GitHub: Vivek Tarun EOF