From: Shane Date: Sun, 11 Jan 2026 03:18:56 +0000 (+0000) Subject: add makefile target: git/set-head X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=7bfaad0dc6806ae865e18bb3d574c94fbe711f9f;p=nutratech%2Fvps-root.git add makefile target: git/set-head --- diff --git a/Makefile b/Makefile index da8e8a0..4aff535 100644 --- a/Makefile +++ b/Makefile @@ -187,3 +187,17 @@ endif ssh $(VPS) "git config --global --add safe.directory /srv/git/$(NEW_GIT)" @echo "Don't forget to update your local remote URL:" @echo "git remote set-url helio-web ssh://$(VPS_USER)@$(VPS_HOST)/srv/git/$(NEW_GIT)" + +.PHONY: git/set-head +git/set-head: ##H @Remote Set default branch (HEAD) for a repo (usage: make git/set-head REPO=... BRANCH=main) +ifndef REPO + $(error REPO is undefined. Usage: make git/set-head REPO=projects/repo.git BRANCH=main) +endif +ifndef BRANCH + $(error BRANCH is undefined. Usage: make git/set-head REPO=... BRANCH=main) +endif + @# Auto-append .git if missing + $(eval REPO_GIT := $(if $(filter %.git,$(REPO)),$(REPO),$(REPO).git)) + @echo "Setting HEAD of $(REPO_GIT) to refs/heads/$(BRANCH)..." + ssh $(VPS) "git --git-dir=/srv/git/$(REPO_GIT) symbolic-ref HEAD refs/heads/$(BRANCH)" + @echo "HEAD updated."