git/list[1] front-page[2] threads[3] people[4] search[5] about
 

cdgit: cd relative to git workdir root

From
TKThomas Koch <thomas-5j3myg3oo4w@public.gmane.org>
Date
Sep 16, 2013, 19:01 UTC
Message-ID
<201309162101.14879.thomas@koch.ro>
Hi,

I frequently have the need to cd back to the root of the current git workdir and created to alias for this:

git alias root = rev-parse --show-toplevel
shell alias cdgit = cd $(git root)
Maybe somebody likes this.

Now it would be cool, to have an alias to cd into a specific subdir of the git worktree and have zsh (or bash) auto completion for this like

git clone git://git.kernel.org/pub/scm/git/git.git cd git/gitweb/static/js/lib (just to be somewhere deep) cdgit con<tab>/com<tab> (becomes: cdgit contrib/completion)

Somebody with zsh/bash skills who already did this?
Regards, Thomas Koch
Next: Adam Spiers
Message 1 of 3 in “cdgit: cd relative to git workdir root”
  1. Thomas KochSep 16, 2013
  2. Adam SpiersSep 16, 2013
  3. martin f krafftSep 17, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.