git-sh icon indicating copy to clipboard operation
git-sh copied to clipboard

Feature: Make 'cd ~' go to project root directory

Open ls12styler opened this issue 13 years ago • 3 comments

As this integrates into the users shell, I think it would be beneficial for the command 'cd ~' (which would usually cd to the users home directory) to cd to the projects root directory instead.

ls12styler avatar Apr 24 '12 13:04 ls12styler

You can add this with cd $(git rev-parse --git-dir)/.. for normal repos with .git inside the directory.

Daenyth avatar Aug 13 '12 17:08 Daenyth

git-sh leverages the shell alias function (type 'alias' while in git-sh to see) and '~' is a shell metacharacter, not available for alias names.

I suggest adding the following line to your .gitshrc file (building on the answer from @Daenyth): alias root='cd $(git rev-parse --git-dir)/..'

phatblat avatar Mar 08 '13 04:03 phatblat

A more robust one is git rev-parse --show-toplevel

Daenyth avatar Jul 14 '16 21:07 Daenyth