Skip to content
Snippets Groups Projects
apply_patches.sh 352 B
Newer Older
  • Learn to ignore specific revisions
  • #!/bin/bash
    
    PATCHDIR=".patches"
    
    apply_patches() {
    	for patch in "$PATCHDIR"/*; do
    		git -C "$(basename "$patch")" apply "../$patch"
    	done
    }
    
    create_patches() {
    	rm -f "$PATCHDIR"/*
    	git submodule foreach -q "git diff > ../$PATCHDIR/"'$name'
    	find "$PATCHDIR" -type f -empty -delete
    }
    
    if [ "$1" == "-c" ]; then
    	create_patches
    else
    	apply_patches
    fi