Commands
cd $(git rev-parse --show-toplevel) # navigates to the root directory of a repo/submodule.
cd $(git rev-parse --git-dir) # navigates to the .git directory.
cd $(git rev-parse --show-superproject-working-tree) # if in a submodule, navigates to the root of the parent.
Aliases
# given a remote branch (for a PR or MR) check it out locally and track it
git config --global alias.new-from-remote '!f() { git checkout -b "$1" "origin/$1"; }; f'
# given a remote branch (for a PR or MR) check it out locally and track it
git config --global alias.new-from-remote '!f() { param($branch); git checkout -b $branch origin/$branch; }; f'