Gathering detailed insights and metrics for git-rev-label
Gathering detailed insights and metrics for git-rev-label
Gathering detailed insights and metrics for git-rev-label
Gathering detailed insights and metrics for git-rev-label
npm install git-rev-label
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
No dependencies detected.
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.
$ git rev-label
master-c73-gbbb6bec
$ 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
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.curl -fsSL 'https://gitlab.com/kyb/git-rev-label/raw/artifacts/master/git-rev-label' | sudo bash -s -- --install
Warning: sudo under hood.
$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
:
[[ ":$PATH:" != *":$HOME/bin:"* ]] && PATH="$HOME/bin:$PATH"
set --export --universal fish_user_paths ~/bin $fish_user_paths
npm install --global git-rev-label
brew tap ivakyb/git-rev-label
brew install git-rev-label
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.
This was the begining.
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.
No vulnerabilities found.
No security vulnerabilities found.