Created
June 18, 2022 09:29
-
-
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
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
_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