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

Re: cdgit: cd relative to git workdir root

From
MKmartin f krafft <madduck-jx/+c5dph7vr7s880joybq@public.gmane.org>
Date
Sep 17, 2013, 05:33 UTC
Message-ID
<20130917053303.GF5390@fishbowl>
In-Reply-To
<201309162101.14879.thomas-5j3myg3OO4w@public.gmane.org>
also sprach Thomas Koch <thomas-5j3myg3OO4w@public.gmane.org> [2013.09.16.2101 +0200]:
> shell alias cdgit = cd $(git root)

I've tried to make this happen many years ago, but I never finished the ZLE widget that did it. The idea was to bind 'tab' to a function that would replace an occurrence of ~g in $LBUFFER with the output of rev-parse--show-toplevel and then delegate to normal tab expansion.

So now I just have
  hash -d g=$(git rev-parse --show-toplevel)
in a pre-prompt function and get the same effect.
  fishbowl:~/code/salt|develop|debian% ls ~g/debi<tab>
-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"i am not in favour of long engagements. they give people the
 opportunity of finding out each other's character before marriage,
 which i think is never advisable."
                                                        -- oscar wilde
 
spamtraps: madduck.bogus-JX/+c5DPh7vR7s880joybQ@public.gmane.org
Previous: Adam Spiers
Message 3 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.