13 lines
610 B
Makefile
13 lines
610 B
Makefile
.PHONY: clean-branches # Очистка отсутствующих веток
|
|
|
|
clean-branches:
|
|
@echo "Fetching updates from origin..."
|
|
git fetch --prune
|
|
@echo "Checking for local branches missing on origin..."
|
|
ifeq ($(OS),Windows_NT)
|
|
@for /f "tokens=1,2*" %%i in ('git branch -vv ^| findstr /C:": gone]"') do git branch -d -D %%i
|
|
@for /f "tokens=1,2*" %%i in ('git branch -vv ^| findstr /C:"[удалённый путь] отсутствует"') do git branch -d -D %%i
|
|
else
|
|
@git branch -vv | grep -E ': gone\]|отсутствует' | awk '{print $$1}' | xargs -r git branch -d -D
|
|
endif
|
|
@echo "Done!" |