Skip to content

Latest commit

 

History

History
58 lines (51 loc) · 3.06 KB

README.md

File metadata and controls

58 lines (51 loc) · 3.06 KB

GitToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

This is a collection of tips and tricks to level up your git usage.

Get the default branch for a given repository

git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g'

Get the latest tag from a repository URL

git -c versionsort.suffix=- ls-remote --tags --sort=v:refname https://github.com/GitHooksToolbox/prompt-default-branch-commit-deprecated '*.*.*' | awk -F/ '/refs\/tags\// {print $3}' | tail -n1