Skip to content

Instantly share code, notes, and snippets.

@jayers99
Created April 2, 2019 16:29
Show Gist options
  • Save jayers99/d9d4f61653aebd7e3ffcbf5dcb220f94 to your computer and use it in GitHub Desktop.
Save jayers99/d9d4f61653aebd7e3ffcbf5dcb220f94 to your computer and use it in GitHub Desktop.
return the root directory of the current git repo
#!/bin/bash
git rev-parse --show-toplevel 2> /dev/null
if [[ $? == 128 ]]; then
echo $PWD
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment