blob: 068e7f319509f76029a1c29efe7daffadca8cbb7 (
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 merge --no-commit "$(origin)"
- $(if $(noncurrentbranches),$(foreach branch,$(noncurrentbranches),git branch -f "$(branch)" "$(origin)/$(branch)" && git checkout "$(branch)" && git merge --no-commit "$(origin)" &&) git checkout "$(master)")
- init:
- # Assume that initial cloning is done already when invoking this target
- # git init
- # git remote add -f -t "$(master)" -m "$(master)" origin "$(origin)"
- # git merge origin
- # git config remote.origin.push +"refs/heads/$(master)":"refs/heads/$(master)"
- $(if $(filter $(currentbranch),$(master)),,git branch -f "$(master)" "$(origin)/$(master)")
- $(if $(noncurrentbranches),$(foreach branch,$(noncurrentbranches),git branch -f "$(branch)" "$(origin)/$(branch)" &&) true)
- $(if $(filter $(currentbranch),$(master)),,git checkout -f "$(master)")
- .PHONY: update init
|