blob: 072617ecb66be57ab8df17549b6753e4a2131559 (
plain)
- # main local branch (the one we want checked out)
- master = master
- # all local branches (including those needed by child clones)
- branches = $(master)
- # local name of origin
- origin = origin
- currentbranch = $(shell git branch | grep ^\* | awk '{ print $2 }')
- noncurrentbranches = $(filter-out $(currentbranch),$(branches))
- update:
- git fetch $(origin)
- $(if $(filter $(currentbranch),$(master)),,git branch -f "$(master)" "$(origin)/$(master)" && git checkout "$(master)")
- git pull "$(origin)"
- $(if $(noncurrentbranches),$(foreach branch,$(noncurrentbranches),git branch -f "$(branch)" "$(origin)/$(branch)" && git checkout "$(branch)" && git pull "$(origin)" &&) git checkout "$(master)")
- init:
- git init
- git remote add -f -m "$(master)" origin "$(origin)"
- git merge origin
- # git config remote.origin.push +"refs/heads/$(master)":"refs/heads/$(master)"
- .PHONY: update init
|