IMPROVED: git directory handling