# fastest way to check if dir is a workdir

2 messages from 2008-08-12 to 2008-08-12. Participants: Thomas Koch, Jeff King.
Thread: https://gitlist.dev/t/14956

## Thomas Koch, 2008-08-12 11:34

Subject: fastest way to check if dir is a workdir
Message-ID: <200808121334.57066.thomas@koch.ro>
URL: https://gitlist.dev/e/200808121334.57066.thomas%40koch.ro

```
Hi,

I'm writing a little php-git-wrapper and would like to have a function
which tells me, whether a given path is part of a git checkout or not.

What would be the fastest commandline to check, whether the current dir
is part of a checkout? It may be assumed that the repository is at the
standard position.

Thanks a lot,
-- 
Thomas Koch, Software Developer
http://www.koch.ro

Young Media Concepts GmbH
Sonnenstr. 4
CH-8280 Kreuzlingen
Switzerland

Tel    +41 (0)71 / 508 24 86
Fax    +41 (0)71 / 560 53 89
Mobile +49 (0)170 / 753 89 16
Web    www.ymc.ch

```

## Jeff King, 2008-08-12 13:01

Subject: Re: fastest way to check if dir is a workdir
Message-ID: <20080812130128.GA28658@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20080812130128.GA28658%40sigill.intra.peff.net
In-Reply-To: <200808121334.57066.thomas@koch.ro>

```
On Tue, Aug 12, 2008 at 01:34:56PM +0200, Thomas Koch wrote:

> I'm writing a little php-git-wrapper and would like to have a function
> which tells me, whether a given path is part of a git checkout or not.
> 
> What would be the fastest commandline to check, whether the current dir
> is part of a checkout? It may be assumed that the repository is at the
> standard position.

How about "git rev-parse --is-inside-work-tree"?

-Peff

```
