Skip to content

Instantly share code, notes, and snippets.

@Engelch
Created June 18, 2022 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Engelch/2bf8a78dff2bfa7187ce5bf708d3eda8 to your computer and use it in GitHub Desktop.
Save Engelch/2bf8a78dff2bfa7187ce5bf708d3eda8 to your computer and use it in GitHub Desktop.
bash check if in git repo and if so jump to root of git repo
_gitRootDir=$(git rev-parse --show-toplevel 2>/dev/null); res=$?
[ $res -eq 0 ] && debug git found, jumping to git root && cd "$_gitRootDir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment