Skip to content

Instantly share code, notes, and snippets.

@dolmen
Last active October 19, 2020 12:29
Show Gist options
  • Save dolmen/d5cd5d8c2dc218a7557571868d6f1827 to your computer and use it in GitHub Desktop.
Save dolmen/d5cd5d8c2dc218a7557571868d6f1827 to your computer and use it in GitHub Desktop.
Git aliases for Go developement #golang #git
# git go-version: shows the Go-modules versionning formatting of a Git commit
git config --global alias.go-version '!f(){ cd -- "${GIT_PREFIX:-.}"; TZ=UTC git log -1 '\''--date=format-local:%Y%m%d%H%M%S'\'' --abbrev=12 '\''--pretty=tformat:v0.0.0-%cd-%h'\'' "$@" ;};f'
# git go-get: shows the command to run on another Go project to upgrade this module
git config --global alias.go-get '!f(){ cd -- "${GIT_PREFIX:-.}"; TZ=UTC git log -1 '\''--date=format-local:%Y%m%d%H%M%S'\'' --abbrev=12 '\''--pretty=tformat:go get '\''"$(go list -m)"'\''@v0.0.0-%cd-%h'\'' "$@" ;};f'
# git go-shorlog: shows the 10 commits in Go-modules versionning style
git config --global alias.go-shortlog '!f(){ cd -- "${GIT_PREFIX:-.}"; TZ=UTC git log -10 '\''--date=format-local:%Y%m%d%H%M%S'\'' --abbrev=12 '\''--pretty=tformat:v0.0.0-%cd-%h %s'\'' "$@" ;};f'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment