-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (25 loc) · 1.07 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# file modified from https://gist.github.com/lumengxi/0ae4645124cd4066f676
.PHONY: *
#################################################################
# help
#################################################################
help:
@echo "GIT TARGETS:"
@echo "\tprune-branches - prune obsolete local tracking branches and local branches"
@echo "\tprune-branches-force|pbf - as above but force delete local branches"
@echo "\tpost-PR-merge-sync|pms - switch to master, pull and run pbf target"
#################################################################
# git targets
#################################################################
prune-branches:
git remote prune origin
git branch -vv | grep ': gone]'| grep -v "\*" | awk '{ print $$1; }' | xargs git branch -d
prune-branches-force:
git remote prune origin
git branch -vv | grep ': gone]'| grep -v "\*" | awk '{ print $$1; }' | xargs git branch -D
pbf: prune-branches-force
post-PR-merge-sync-step-1:
git switch master
git pull
post-PR-merge-sync: post-PR-merge-sync-step-1 prune-branches-force
pms: post-PR-merge-sync