#!/bin/sh DIR="$(readlink -f "$PWD")" # traverse back to the root and do some check while [ "$DIR" != "/" ] do # if we have a .git dir, we're at the root of a project if [ -d "$DIR/.git" ] then echo "$DIR" exit 0 fi # we stop at these hard coded directories if [ "$DIR" == "$(readlink -f "$(