-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #794 from unixorn/add-git-semvers
Add Daniel's `git-semvers`
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | Removes files you deleted with `rm` from the repository for you. | | ||
| `git-root-directory` | Joe Block <[email protected]> | 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. | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
git-semvers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]++' |