#!/usr/bin/env bash # git script that will return the root path of a git project, even if currently in a submodule. # uses git >= 2.13 --show-superproject-working-tree superproject=$(git rev-parse --show-superproject-working-tree) if [ -z "$superproject" ]; then git rev-parse --show-toplevel; else echo "$superproject"; fi