Question

I have some custom filter scripts that I use in my Git repo.

Currently, they are checked in along with my sources which sometimes leads to problems: when I check out a revision older than that where I added the filter scripts to my repo, I get warnings that the filters could not be executed because they cannot be found.

In order to overcome this, I want to put the scripts inside the .git folder so that they are present where I need them but don't make problems when checking out older revisions.

I want to keep them in the repo because the script contents are repo specific, so simply putting them to another location on my machine is not what I'm looking for.

Question is: are there some 'safe' locations inside the .git folder where I could store my scripts?

Safe in the sense that the scripts don't get cleaned up automagically or make problems with further Git versions.

Was it helpful?

Solution

The contents of the .git folder itself aren't very dynamic (what changes rather unpredictably are the refs and the logs, so just stay away from them).

If you take a look at the .git folder of any of your repos, you'll have a pretty good idea what is usually there.

AFAIK, folders in the top level of the .git folder do not usually start with a period, so you could just make a folder .git/.scripts to contain your private script files.

If you want, you can also make that inside the info folder -- that's really up to you and which you find more orderly.

OTHER TIPS

Why not just include the names of the scripts in a .gitignore file? That way, your scripts are not tracked and you can place them anywhere you want in the repo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top