Last active
February 11, 2019 09:34
-
-
Save drAlberT/606e0698cb00805efa3a6f1c3ee97a3e to your computer and use it in GitHub Desktop.
Revisions
-
drAlberT revised this gist
Feb 11, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ # Quick script to automatically update git submodules on checkout. # Save it in the repo `.git/hooks` dir and make it executable #echo "post-checkout hook: '$1' '$2' '$3'" oldRef=$1 newRef=$2 @@ -24,5 +24,5 @@ function isChanged { if isChanged '.gitmodules'; then echo "Change detected to '.gitmodules', updating git submodules." git submodule update --init --force # --recursive fi -
drAlberT revised this gist
Feb 9, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/usr/bin/env bash # # Quick script to automatically update git submodules on checkout. # Save it in the repo `.git/hooks` dir and make it executable echo "post-checkout hook: '$1' '$2' '$3'" @@ -21,8 +21,8 @@ function isChanged { git diff --name-only $oldRef $newRef | grep "^$1\$" >/dev/null 2>&1 } if isChanged '.gitmodules'; then echo "Change detected to '.gitmodules', updating git submodules." git submodule update --init --recursive --force fi -
drAlberT created this gist
Feb 9, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/usr/bin/env bash # # Quick script to automatically update git submodules on checkout. # Save it in the repo `.git/hooks` dir and make it executable echo "post-checkout hook: '$1' '$2' '$3'" oldRef=$1 newRef=$2 # Exit early if the local branch is behind the remote LOCAL=$(git rev-parse @) REMOTE=$(git rev-parse @{u} 2> /dev/null) BASE=$(git merge-base @ @{u} 2> /dev/null) if [[ "$LOCAL" != "$REMOTE" && "$LOCAL" = "$BASE" ]]; then exit 0 fi function isChanged { git diff --name-only $oldRef $newRef | grep "^$1\$" >/dev/null 2>&1 } if isChanged '.submodules'; then echo "Change detected to '.submodules', updating git submodules." git submodule update --init --recursive --force fi