# How does git deal with hard links in source code?

2 messages from 2010-08-23 to 2010-08-23. Participants: Seth Kriticos, Jakub Narebski.
Thread: https://gitlist.dev/t/24832

## Seth Kriticos, 2010-08-23 08:33

Subject: How does git deal with hard links in source code?
Message-ID: <AANLkTik3858Kf6MSPALeNYrE6L=ixf=0s028+_ie_SW_@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTik3858Kf6MSPALeNYrE6L%3Dixf%3D0s028%2B_ie_SW_%40mail.gmail.com

```
Hi list,

I've got a question my google-fu and the docs were not able
to answer:

Is there a way to preserve the hard links that are within
a git repository checkout (the stuff that is tracked by the
git repository)?

The use-case I have is the following: I want to have two
different template directories for stuff in the tracked
sources: a base one and some extended ones. I want to have
the stuff from the base one hard-linked to the extended one,
so changes in the base one change all the other depending
templates too.

Now for testing I committed and pushed an instance of this
and then cloned the repository, and it ate my hard links
(checked out two separate copies of the files).

Is there a way to convince git not to eat my hard links
without some complicated scripting magic and checkout hooks?

~ Seth Kriticos

```

## Jakub Narebski, 2010-08-23 09:00

Subject: Re: How does git deal with hard links in source code?
Message-ID: <m3fwy5og9p.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3fwy5og9p.fsf%40localhost.localdomain
In-Reply-To: <AANLkTik3858Kf6MSPALeNYrE6L=ixf=0s028+_ie_SW_@mail.gmail.com>

```
Seth Kriticos <seth.kriticos@googlemail.com> writes:

> I've got a question my google-fu and the docs were not able
> to answer:
> 
> Is there a way to preserve the hard links that are within
> a git repository checkout (the stuff that is tracked by the
> git repository)?

No, there isn't, and there shouldn't.  Not all filesystems support
hardlinks.
 
> The use-case I have is the following: I want to have two
> different template directories for stuff in the tracked
> sources: a base one and some extended ones. I want to have
> the stuff from the base one hard-linked to the extended one,
> so changes in the base one change all the other depending
> templates too.
> 
> Now for testing I committed and pushed an instance of this
> and then cloned the repository, and it ate my hard links
> (checked out two separate copies of the files).
> 
> Is there a way to convince git not to eat my hard links
> without some complicated scripting magic and checkout hooks?

Make hardlinks on deploy.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```
