darkrc/bin/gitpath

9 lines
157 B
Bash
Executable file

#!/bin/sh
top=$(git rev-parse --show-toplevel 2>/dev/null | sed -e 's/\//\\\//g')
if [ -n "$top" ]
then
echo $(pwd | sed -e "s/^$top//")
else
exit 1
fi