unpushedCommitsCmd="git log @{u}.."; # Source: https://stackoverflow.com/a/8182309
# check if there are unpushed changesif [ -n "$($getGitUnpushedCommits)" ]; then # Check Source: https://stackoverflow.com/a/12137501echo "You have unpushed changes. Push them first!"$getGitUnpushedCommits;exit 2fi
unpushedInSubmodules="git submodule foreach --recursive --quiet ${unpushedCommitsCmd}"; # Source: https://stackoverflow.com/a/24548122# check if there are unpushed changes in submodulesif [ -n "$($unpushedInSubmodules)" ]; thenecho "You have unpushed changes in submodules. Push them first!"git submodule foreach --recursive ${unpushedCommitsCmd} # not "--quiet" this time, to display detailsexit 2fi