From 917f6ce3f31c0749b26a01f61619d3de2f88fa83 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Thu, 5 Jan 2023 11:39:22 -0600 Subject: [PATCH] feat(build): add git multi-push target --- Makefile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a84128f4..119ec38d 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,16 @@ -git-push: - git push github - git push gitlab \ No newline at end of file +export GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) +export GIT_COMMIT ?= $(shell git rev-parse HEAD) +export GIT_OPTIONS ?= +export GIT_REMOTES ?= $(shell git remote -v | awk '{ print $1; }' | sort | uniq) +export GIT_TAG ?= $(shell git tag -l --points-at HEAD | head -1) + +.PHONY: git-stats git-push + +# from https://gist.github.com/amitchhajer/4461043#gistcomment-2349917 +git-stats: ## print git contributor line counts (approx, for fun) + git ls-files | while read f; do git blame -w -M -C -C --line-porcelain "$$f" |\ + grep -I '^author '; done | sort -f | uniq -ic | sort -n + +git-push: ## push to both github and gitlab + git push $(GIT_ARGS) github $(GIT_BRANCH) + git push $(GIT_ARGS) gitlab $(GIT_BRANCH)