Skip to main content
ertius.org

go to git root

It's very handy when using git (or any other version control tool) in the shell to be able to jump back to the root of the repo, to run a build command or get a clearer diff output or whatever. Here's a shell function:

g4d() {
    cd $(git rev-parse --show-toplevel)
}