Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 12
    I looked at git-rev-parse(1). It seems like "git rev-parse --show-toplevel" will suffice. Thank you! :-)
    – valya
    Commented Apr 10, 2011 at 19:03
  • 1
    Is the outer command substitution really needed here? Running in a subshell ((cd … ; pwd)) may be enough. Please see What is wrong with echo $(stuff)? Commented Mar 9, 2020 at 17:14
  • 1
    The problem is, that git rev-parse --show-toplevel and your comment both dont work when you are in the .git dir e.g. in a hook-script
    – Radon8472
    Commented Sep 2, 2020 at 7:30