darkrc/bin/gitpath

10 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