# Re: git only one file

2 messages from 2009-08-25 to 2009-08-26. Participants: Giuseppe Bilotta.
Thread: https://gitlist.dev/t/20734

## Giuseppe Bilotta, 2009-08-25 21:29

Subject: Re: git only one file
Message-ID: <1251235768-24921-1-git-send-email-giuseppe.bilotta@gmail.com>
URL: https://gitlist.dev/e/1251235768-24921-1-git-send-email-giuseppe.bilotta%40gmail.com
In-Reply-To: <synhedionn@gmail.com>

```
synhedionn <synhedionn@gmail.com> wrote:

> with git add . Â , a directory is expected, but I don't need all my files to
> be recorded, only one of my thousands, so how can I record just 1 file?

Generally, if you want to track a single file in a directory you just
add that file, as per Matthias' suggestion, and possibly create a
.gitignore with the single '*' pattern in it..

<shameless plug>
However, if you want to track more than one _independent_ files in the
same directory (RCS-style), then I would recommend you look into zit,
the Git-based single-file content tracker I've developed. You can find
it at git://git.oblomov.eu/zit ( gitweb at http://git.oblomov.eu/zit )
</shameless plug>

```

## Giuseppe Bilotta, 2009-08-26 04:30

Subject: Re: git only one file
Message-ID: <cb7bb73a0908252130u792a328bta1e186ff8f5454b8@mail.gmail.com>
URL: https://gitlist.dev/e/cb7bb73a0908252130u792a328bta1e186ff8f5454b8%40mail.gmail.com
In-Reply-To: <a7c6f4d60908251605l5fb771a5t79b27cf688fab205@mail.gmail.com>

```
On Wed, Aug 26, 2009 at 1:05 AM, syn hedionn<synhedionn@gmail.com> wrote:
> ok , but if I put,
> git add index.htm
> I have:
> fatal: Not a git repository

You need to initialize the repository before you can add files to it, so:

git init
git add index.htm
git commit -m "Initial commit"

The zit way would be:

zit track index.htm
zit commit -m "Initial commit" index.htm

-- 
Giuseppe "Oblomov" Bilotta

```
