@simbo/git-constants
v1.0.1
Published
A small collection of Git-related constants for working with Git references, branches, tags, and commit identifiers in a consistent way.
Maintainers
Readme
Git Constants
A small collection of Git-related constants that can be reused across Node.js and TypeScript projects.
Useful for working with Git references, branches, tags, and commit identifiers in a consistent way.
Features
Predefined constants for common Git concepts
Covers
.gitfolder name, reference prefixes (refs/,refs/heads/,refs/remotes/,refs/tags/,refs/pulls/), and/mergesuffixDefault branch name (
main)Short SHA length (
7) for commit referencesFully typed with TypeScript
Zero dependencies
Installation
Install @simbo/git-constants from the npm registry:
npm i [-D] @simbo/git-constantsUsage
For a complete API reference, see the documentation.
import {
GIT_DEFAULT_BRANCH,
GIT_FOLDER,
GIT_REFS_PREFIX,
GIT_REFS_HEADS_PREFIX,
GIT_SHA_SHORT_LENGTH,
} from '@simbo/git-constants';
console.log(GIT_DEFAULT_BRANCH); // "main"
console.log(GIT_FOLDER); // ".git"
console.log(GIT_REFS_PREFIX); // "refs/"
console.log(GIT_REFS_HEADS_PREFIX); // "refs/heads/"
console.log(GIT_SHA_SHORT_LENGTH); // 7