martijn9612
martijn9612

Reputation: 58

Git overwrite certain files with every pull/push

I am currently working on a project using a git repository and having some issues. We are building an app with angular and have several .js and .css files. We are currently using grunt to concatenate and minify these files because we don't want to include all the .css and .js files in the main html file. By doing this we only have to import 2 files, the css and js file that are both concatenated.

The easy solution would be to just use .gitignore on these files to avoid constant merges in the repository, as we thought so too. But we are building the app with angular, giving us the option to build the apps in Phonegap and practically make it native apps. The problem with ignoring the concatenated .js and .css files is that the build process needs these files for the build process.

I think we can solve this problem by having these files never pulled and always completely overwritten on pushing. Or always have the version of the file on the repository overwrite the local version, and upon pushing running grunt again (we are using grunt watch) and having the local version always overwrite the version on the repository.

How would you guys solve such a problem? As you may have read, I have some probable solutions, but yet to figure out how to solve them. I would be very interested in your solutions.

Upvotes: 0

Views: 84

Answers (1)

Jelle
Jelle

Reputation: 586

I usually solve this with:

git update-index --assume-unchanged

Documentation for git update-index

Posible duplicate: Keep file in a Git repo, but don't track changes

Upvotes: 1

Related Questions