Last active
August 29, 2015 14:26
-
-
Save yhordi/6a7afbccebf31f13f89b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_git_root(path = Dir.pwd) | |
return nil if path == '/' | |
git_present = Dir.entries(path).include?('.git') | |
if !git_present | |
Dir.chdir(File.expand_path("..", Dir.pwd)) | |
find_git_root(Dir.pwd) | |
end | |
p 'found git' | |
end | |
find_git_root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment