Skip to content

Instantly share code, notes, and snippets.

@unrevised6419
Created May 2, 2026 17:38
Show Gist options
  • Select an option

  • Save unrevised6419/6b0a6188391533319cae4d479a0e6a33 to your computer and use it in GitHub Desktop.

Select an option

Save unrevised6419/6b0a6188391533319cae4d479a0e6a33 to your computer and use it in GitHub Desktop.
change directory (cd) into a repo
# cd into the root of the worktree
cdw() {
cd "$(git rev-parse --show-toplevel)"
}
# cd into the root of the default worktree
cdr() {
cd "$(git rev-parse --git-common-dir | xargs dirname)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment