Re: cdgit: cd relative to git workdir root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 16, 2013 at 09:01:14PM +0200, Thomas Koch wrote:
> 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.

I do, and I was about to copy it into my own config when I discovered
that I'd already done this 4 years ago and totally forgotten about it :)

> 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?

I hadn't done this before today, but it's easy in zsh:

  https://github.com/aspiers/git-config/commit/89df1d78

Of course, _gitcd needs to be somewhere on your $fpath so it can be
autoloaded.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]