mirror of
https://github.com/pgrondek/config.git
synced 2024-11-25 21:25:39 +00:00
[git] Add custom command
This commit is contained in:
parent
b750db62d4
commit
d1ef5a0b26
15
git/Makefile
15
git/Makefile
@ -1,10 +1,13 @@
|
|||||||
GIT_BIN=/usr/bin/git
|
GIT_BIN=/usr/bin/git
|
||||||
PACKAGE=git
|
PACKAGE=git
|
||||||
|
|
||||||
|
CUSTOM_BINS= $(wildcard bin/*)
|
||||||
|
|
||||||
GIT_CONFIG=config
|
GIT_CONFIG=config
|
||||||
GIT_CONFIG_OUT=$(HOME)/.config/git/config
|
GIT_CONFIG_OUT=$(HOME)/.config/git/config
|
||||||
GIT_GLOBAL_CONFIG=$(HOME)/.gitconfig
|
GIT_GLOBAL_CONFIG=$(HOME)/.gitconfig
|
||||||
CONFIG_DIR=$(HOME)/.config/git
|
CONFIG_DIR=$(HOME)/.config/git
|
||||||
|
HOME_BIN_DIR=$(HOME)/bin
|
||||||
|
|
||||||
ROOT_APT=sudo aptitude
|
ROOT_APT=sudo aptitude
|
||||||
|
|
||||||
@ -13,12 +16,15 @@ OUT=$(GIT_CONFIG_OUT)
|
|||||||
.PHONY: clean_install
|
.PHONY: clean_install
|
||||||
|
|
||||||
clean_install: clean install
|
clean_install: clean install
|
||||||
install: $(GIT_BIN) config
|
install: $(GIT_BIN) install_bins config
|
||||||
clean: clean_config clean_package
|
clean: clean_config clean_package clean_bins
|
||||||
|
|
||||||
$(GIT_BIN):
|
$(GIT_BIN):
|
||||||
$(ROOT_APT) install $(PACKAGE)
|
$(ROOT_APT) install $(PACKAGE)
|
||||||
|
|
||||||
|
install_bins: $(HOME_BIN_DIR)
|
||||||
|
cp $(CUSTOM_BINS) $(HOME_BIN_DIR)
|
||||||
|
|
||||||
.ONESHELL:
|
.ONESHELL:
|
||||||
config: $(CONFIG_DIR) $(GIT_BIN)
|
config: $(CONFIG_DIR) $(GIT_BIN)
|
||||||
ifeq ("$(wildcard $(GIT_GLOBAL_CONFIG))","")
|
ifeq ("$(wildcard $(GIT_GLOBAL_CONFIG))","")
|
||||||
@ -32,9 +38,14 @@ endif
|
|||||||
$(CONFIG_DIR):
|
$(CONFIG_DIR):
|
||||||
mkdir -p $(CONFIG_DIR)
|
mkdir -p $(CONFIG_DIR)
|
||||||
|
|
||||||
|
$(HOME_BIN_DIR):
|
||||||
|
mkdir -p $(HOME_BIN_DIR)
|
||||||
|
|
||||||
clean_package:
|
clean_package:
|
||||||
$(ROOT_APT) purge $(PACKAGE)
|
$(ROOT_APT) purge $(PACKAGE)
|
||||||
|
|
||||||
clean_config:
|
clean_config:
|
||||||
rm -f $(GIT_CONFIG_OUT)
|
rm -f $(GIT_CONFIG_OUT)
|
||||||
|
|
||||||
|
clean_bins:
|
||||||
|
rm -f $(CUSTOM_BINS:bin%=$(HOME_BIN_DIR)%)
|
||||||
|
3
git/bin/git-purge
Executable file
3
git/bin/git-purge
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
git branch --merged|egrep -v "(^*|master|dev)" | xargs git branch -d
|
Loading…
Reference in New Issue
Block a user