Wakkos
Wakkos

Reputation: 99

GIT: Ignore file when pulling but not when pushing

I have a GIT repo to do frontend mostly: Scss preprocessor and JS.

The problem is that we change different .scss files and compile them into a .css one (we are 4, 5 and sometimes 6 frontends) and it gives a conflict when pulling. .css files always throw a conflict.

This is reasonable, since .css file is always different, but I want to ignore those conflicts, since we have a LOT of merges to solve those conflicts (Unnecessary merges, from our point of view) .

I cannot ignore the .css file in GIT, because project managers and others are always pulling the repo to test and show to clients.

Is there a way that we can always PUSH our .CSS file but not PULL it?

Upvotes: 1

Views: 838

Answers (1)

GreyCat
GreyCat

Reputation: 17132

The canonical answer is that you're doing it wrong and you're not supposed to store generated files, such as these .css in your case. Typical workflow and environment to work with generated (compiled) files usually involves:

  • Storing only sources in version control
  • Developers each compile their own target files (usually slightly different due to environment differences) using their own development boxes / environments
  • There is some sort of "deployment" process that compiles and produces "deployable artifacts" (i.e. in stable environment with reproducible results, given the same set of source files)
  • These artifacts have the following life cycle:artifacts:
    • first, they get deployed to the stage environment,
    • then QA checks it throughly,
    • finally they get deployed into production.

However, your mileage may vary, of course. Could you elaborate, what was your original reason to commit generated files into the repository?

Upvotes: 3

Related Questions