Skip to content

Latest commit

 

History

History

git

@commit-generator/git

This package provides Git integration utilities for the Commit Generator project. It enables checking repository status, managing commits, viewing logs, and handling diffs.

Installation

To use this package in your project, install it as a dependency:

pnpm install @commit-generator/git

Usage

  1. Checking if the current directory is a Git repository
import { git } from '@commit-generator/git';

if (git.isRepository()) {
  console.log('This is a Git repository');
} else {
  console.log('Not a Git repository');
}
  1. Viewing unstaged/staged changes with diff
const diffOutput = git.diff({ staged: false });
console.log(diffOutput);
  1. Committing changes
git.commit('Initial commit');
  1. Amending the last commit
git.amend('Updated commit message');
  1. Viewing commit logs
const logs = git.log(5);
console.log(logs);
  1. Adding all changes to staging
git.add();

License

This package is licensed under the MIT License.