Skip to content

Instantly share code, notes, and snippets.

@key-amb
Created April 14, 2016 03:55
Show Gist options
  • Save key-amb/1e4d6bbc85d16eb960dcf67022c6e1db to your computer and use it in GitHub Desktop.
Save key-amb/1e4d6bbc85d16eb960dcf67022c6e1db to your computer and use it in GitHub Desktop.
Makefile to update git repository with submodules
.PHONY: update update-all all
update:
git pull origin master
git submodule update --init
update-all: update
git submodule foreach git pull origin master
all: update-all
% make # to update
% make all # to update with submodules' update out of this repository
@BlazeIsClone
Copy link

specific improvement: $ make command will pull all submodules and sync, then checkout the main branch

.PHONY: default update update-all all
default: all ;

update:
	git pull origin main
	git submodule update --init

update-all: update
	git submodule foreach git pull origin main
	git submodule foreach git checkout main

all: update-all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment