Sophia_ES
Sophia_ES

Reputation: 1361

Best place in .git folder for an add-on specific directory?

I am writing a Git add-on that requires a directory where special files can be placed that affect the local behavior of the add-on that I am writing. The contents of this directory can differ not only from one project to another, but even from one clone of the project to another - therefore it is important that the contents of this directory do not get exchanged, even in the event of pulling, pushing, or cloning of the repository.

Though the purpose of these files does involve configuration - it can not go into ".git/config" because these can not be mere variable-values, but must be full-fledged files.

Currently, I have this in a special directory outside of the .git directory - and exchange of the data is prevented by the fact that the add-on requires that this directory be registered in ".gitignore". However - I am wondering if there is a better way to do this -- as in, within the .git directory.

My question is this --- are there any recommended "best, safe practices" for me to do this that will minimize the chances of my add-on interfering with anything else or vice-versa?

Upvotes: 2

Views: 55

Answers (1)

Gregg
Gregg

Reputation: 2624

git doesn't care if you add files to the .git directory. Just don't stomp on the files that it uses such as HEAD, FETCH_HEAD etc. For example you can copy the .git/config file to .git/config.save to have a backup while editing the config file. When git does pushes/pulls/clones etc. It only references the files that it needs.

Upvotes: 1

Related Questions