EpsilonVector
EpsilonVector

Reputation: 4053

Is it possible to have a folder inside .git that changes with branch?

I want to implement branch specific functionality to help me with my git work flow. To do that, I need to save some metadata (not necessarily in one file) regarding the branch, and I'd like to keep it hidden from the actual files under version control, but still "on site" - it should follow me if I decide to relocate my repositories folders. .git seems to be a fitting place for that, but I haven't found a way to have a folder inside it that will change with the branch.

Is such a thing possible? How?

Upvotes: 0

Views: 58

Answers (1)

poke
poke

Reputation: 387955

The .git folder is the only thing in the working directory that is never tracked by the Git repository. If you want to have that meta stuff included in the repository and keep it for example when you clone or push, then you will have to keep it in the working directory and add it in the usual way.

Otherwise if you are fine with it being just there for your one local repository, then sure, put it in the .git folder. You will not be able to version your metadata then though or change it when the branch changes; you will need to have a different mechanism for that.

Otherwise I would argue that if the data is relevant to your source, you should keep it in the working directory and have it versioned by Git. Or if it’s not that relevant, it shouldn’t be there at all.

Upvotes: 1

Related Questions