Skip to content

Commit

Permalink
Merge pull request #794 from unixorn/add-git-semvers
Browse files Browse the repository at this point in the history
Add Daniel's `git-semvers`
  • Loading branch information
unixorn authored Nov 19, 2024
2 parents d38a6ae + a1cf3a9 commit d6a4290
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ If you wrote one of these scripts and want it removed from this collection, plea
| `git-rm-deleted-from-repo` | Joe Block <jpb@unixorn.net> | Removes files you deleted with `rm` from the repository for you. |
| `git-root-directory` | Joe Block <jpb@unixorn.net> | Prints the path to the root of the `git` repository you're in. |
| `git-run-command-on-revisions` | Gary Bernhardt's [dotfiles](https://github.com/garybernhardt/dotfiles) | Runs a given command over a range of `git` revisions. |
| `git-semvers` | [Daniel Hoherd](http://github.com/danielhoherd) | List all the tags in a repo that are semver compliant |
| `git-shamend` | Danielle Sucher's [git-shamend](http://www.daniellesucher.com/2014/05/08/git-shamend/) blog post | Amends your staged changes as a fixup (keeping the pre-existing commit message) to the specified commit, or HEAD if no revision is specified. |
| `git-show-overwritten` | Mislav Marohnić's [dotfiles](https://github.com/mislav/dotfiles) | Aggregates `git blame` information about the original owners of lines changed or removed in the '<base>...<head>' diff. |
| `git-shrink-repo` | Based on [gimbo/gimbo-git.zsh](https://github.com/gimbo/gimbo-git.zsh/blob/master/gimbo-git.zsh) | Shrinks your clone of a `git` repository. |
Expand Down
1 change: 1 addition & 0 deletions bin/git-list-semvers
38 changes: 38 additions & 0 deletions bin/git-semvers
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
#
# Originally from hangops slack

set -o pipefail
set -e

if [[ -n "$DEBUG" ]]; then
# shellcheck disable=SC2086
if [[ "$(echo $DEBUG | tr '[:upper:]' '[:lower:]')" == "verbose" ]]; then
set -x
fi
fi

function debug() {
if [[ -n "$DEBUG" ]]; then
echo "$@"
fi
}

function echo-stderr() {
echo "$@" 1>&2 ## Send message to stderr.
}

function fail() {
printf '%s\n' "$1" >&2 ## Send message to stderr. Exclude >&2 if you don't want it that way.
exit "${2-1}" ## Return a code specified by $2 or 1 by default.
}

function my-name() {
basename "$0"
}

function usage() {
echo "Usage: $(my-name) ARG ARG"
}

git tag -l "v*.*.*" --sort=-v:refname | awk -F. '!seen[$1,$2]++'

0 comments on commit d6a4290

Please sign in to comment.