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 🙏

© 2026 – Pkg Stats / Ryan Hefner

git-rev-label

v2.27.39

Published

Obtain information about Git repository revision in format like 'master-c73-gbbb6bec'

Readme

pipeline status releases

git-rev-label

Gives information about Git repository revision in format like 'master-c73-gabc6bec'. Can fill template string or file with environment variables and information from Git. Useful to provide information about version of the program: branch, tag, commit hash, commits count, dirty status, date and time. One of the most useful things is count of commits, not taking into account merged branches - only first parent.

Usage

$ git rev-label
master-c73-gbbb6bec

Part 2 – Walk over git commits and show how rev-label detects branch, tag, detached and dirty states

Part 3 – List available variables and fill template file

$ git rev-label --help
Gives information about Git repository revision in format like 'master-c73-gbbb6bec'.
Can fill template string or file with environment variables and information from Git. 
Useful to provide information about version of the program: branch, tag, commit hash, 
commits count, dirty status, date and time. One of the most useful things is count of 
commits, not taking into account merged branches - only first parent.

USAGE:
   git rev-label
   git rev-label [--help|-h|-?]
   git rev-label [--version|-V]
   git rev-label '$refname-c\$count-g\$short\$_dirty'
   git rev-label --format="`cat build_info.template.h`"
   git rev-label --format-file=build_info.template.h
   git rev-label --variables [--export]
   eval $( git rev-label --variables [--export] )

COMPLEX USE CASE:
 * Fill `build_info.template.h` with branch, tag, commit hash, commits count, dirty status. 
   Than include result header to access build information from code. 
   See https://gitlab.com/kyb/git-rev-label/blob/master/build_info.template.h and
   https://gitlab.com/kyb/git-rev-label/blob/master/create-build-info.sh

INSTALLATION:
   ./git-rev-label --install|--install-link [--install-dir=/usr/local/bin]

UPDATE:
   git rev-label --update

More info at https://gitlab.com/kyb/git-rev-label

Run witout install

  • npx git-rev-label
  • docker run -it ikyb/git-rev-label
    If wanna run always in container
    alias git-rev-label='docker run -it --rm -v"$PWD":"$PWD" -w"$PWD" ikyb/git-rev-label git-rev-label '
    or create executable file git-rev-label in PATH with the same contents.

Install

Raw without package manager

curl -fsSL 'https://gitlab.com/kyb/git-rev-label/raw/artifacts/master/git-rev-label' | sudo bash -s -- --install

Warning: sudo under hood.

Manual to $HOME/bin without sudo:
curl -fsSL 'https://gitlab.com/kyb/git-rev-label/raw/artifacts/master/git-rev-label' | bash -s -- --install=$HOME/bin

Then make sure $HOME/bin is in $PATH:

  • bash
    [[ ":$PATH:" != *":$HOME/bin:"* ]] && PATH="$HOME/bin:$PATH"
  • fish
    set --export --universal fish_user_paths ~/bin $fish_user_paths

with NPM

npm install --global git-rev-label

with Homebrew OUTDATED

brew tap ivakyb/git-rev-label
brew install git-rev-label

Examples

Take a look into build_info-header. It shows how git-rev-label is used to generate C header file build_info.h with information about version extracted from Git.


build-info-header (legacy)

This was the begining.

bash script extracts information from Git and creates C header files with defined symbols to information about current build.

Use cases

This is super useful when you want store some information about current build in compiled binary.

Shell script creates build_info.h C header file with information about repository: branch, tags, timestamps, etc. Include this header to access build information from code.


ToDo

  • move to dedicated project group gitlab.com/git-rev-label
  • move artifacts/* branches family to dedicated repo gitlab.com/git-rev-label/releases
  • use also releases page of main development repo, keep it in sync with releases-repo