From: Matthieu Moy Date: Sun, 30 Nov 2014 11:58:54 GMT Subject: Re: [PATCH] introduce git root Message-ID: In-Reply-To: Arjun Sreedharan writes: > On 30 November 2014 at 04:38, Philip Oakley wrote: >> From: "Arjun Sreedharan" >>> >>> This introduces `git root` which outputs the root directory >>> (the directory that contains .git). >>> The same can be accomplished by `git rev-parse --show-toplevel`. >>> `git root` is much more intuitive and easy to remember. >>> All it does is set the arguments for rev-parse >> >> >> This may be better as an alias. >> I've added it to my aliases list. >> > > I know that. I am suggesting this to be a built-in command, without having the > need to add as an alias. Indeed, suggesting people to add an alias does not solve the discoverability issue. git rev-parse --show-toplevel is not just long, it's just not the place where people would look for (it's neither about revision nor about parsing, so clearly, "rev-parse" is not a good place to host the feature in the UI). If we were to rewrite Git from scratch, then I would be all for having a "git root" command. Given that we already have rev-parse --show-toplevel, and that we'll have to keep it anyway for backward compatibility, I'm a bit more hesitant ("Git is hard to use because it doesn't have enough commands" is not a complain I hear so often ;-) ), but still mostly positive. If we go this way, then the documentation must be updated too. I think the doc should still recommend "git rev-parse --show-toplevel" for scripting until Git versions implementing "git root" are widely deployed enough. Also, there are other options of git rev-parse which should be dealt with: at least --show-cdup (could be eg. "git root --relative") and --show-prefix, but probably also others from the "Options for Files" in the man of git-rev-parse. -- Matthieu Moy http://www-verimag.imag.fr/~moy/