Reputation: 2027
I have multiple project trees that are based on the same remote repo. I want to cd into a specific directory in any of them but based on where is PWD at this moment.
Example:
If I have 3 clones
clone1
clone2
clone3
And when in clone2/test/ I want to be able to do CDGOTO and will automatically go to some directory like
clone2/test/test1/test2/foo
So the shell command would evaluate the current git repo I am in then cd into that repo looking for the interesting directory.
If I was in clone1 then CDGOTO will go to:
clone1/test/test1/test2/foo
Upvotes: 0
Views: 892
Reputation: 94696
alias CDGOTO='cd $(git rev-parse --show-toplevel)/test/test1/test2/foo'
Upvotes: 4