3

In our repository some files and folders are ignored. Of interest here are:

  1. Build output folders which contain (among others) some configuration files and external binary modules. Note that this means that those files of interest are located within already ignored folders ("bin" folders).
  2. Setup scripts which are placed along source code. Those scripts are ignored because they are programmer-specific (for example they contain paths to external libraries on local machine).

Yet I would like to trace those files for myself only. Mostly to recreate them easly after cleaning but there are other reasons as well.

How to achieve that?


There is already a similar question: Track files in local Git repo but ignore in remote. But it is only similar and thus answers proposed there are not applicable here:

  1. My ignored-to-be-tracked files are not placed in a single folder (and it would be impractical to place them so). They are in various places in entire tree. And they are quite sparse by the way. Only a few of them.
  2. Alternative branch cannot be used since I need those files all the time in various branches, not just after switching to that alternative branch.
Community
  • 1
  • 1
Adam Badura
  • 5,069
  • 1
  • 35
  • 70

2 Answers2

1

This is a bit hackish, but how about symlinking them from a separate repo into your main project?

Michael Wild
  • 24,977
  • 3
  • 43
  • 43
  • That depends on your version. AFAIK everything from Vista/2008 on supports symlinks, although this feature is not exposed through the graphical shell. See e.g. [this article](http://www.howtogeek.com/howto/windows-vista/using-symlinks-in-windows-vista/). – Michael Wild Feb 08 '13 at 09:03
1

First, you can add an ignored file to the index and commit it.
You just need to to git add --force -- /path/to/file.

Second, you can add the setup files themselves: they contain private data.
You may consider the template approach, based on a content filter driver which, on checkout, would generate those files (as private non-versioned files) based on:

  • template files (versioned)
  • value files (stored elsewhere, with the right value for each developer's environment)

smudge

See for instance "How to keep different content of one file in my local and github repository?"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • That is an interesting idea! However I see some disadvantages: (1) it seems not so trivial to do, (2) using that approach seems more or less all-or-none: others would have to use it as well, (3) it goes very well with files like configuration where format is fixed. But setup scripts (at least those we use) are not so easily (or not at all) templated. – Adam Badura Feb 08 '13 at 23:54
  • 1
    @AdamBadura I understand, it was just an idea. – VonC Feb 09 '13 at 11:09