Files
.dotfiles/.local/bin/git-root
2024-03-04 21:42:47 +01:00

10 lines
328 B
Bash
Executable File

#!/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