开发者

git pull with gzip files in repo?

开发者 https://www.devze.com 2023-02-19 18:42 出处:网络
I have a repo that contains my minified css/js files.Some of them are gzipped.When i go between staging and production doing push and pulls it tries to auto merge and fails on the gz ones citing it ca

I have a repo that contains my minified css/js files. Some of them are gzipped. When i go between staging and production doing push and pulls it tries to auto merge and fails on the gz ones citing it cannot auto merge binary files.

Is there a way to tell git to never try to merge a certain directory开发者_StackOverflow but rather only push that directories changes when a push request is made?

Any other ways you guys go about this?

Thanks!!

UPDATE:

I tried putting the following in .gitattributes

*.gz merge=keepTheir

And still getting this whenever I push: (mind you, someone else pushed before me and updated files into that repo)

Auto-merging public/assets/upload.css.gz
CONFLICT (content): Merge conflict in public/assets/upload.css.gz

What am I doing wrong?


If you need the content you want to push to overwrite (instead of merge) the destination, you can define a custom merge driver in .gitattribute file in order to specify how you want the *.gz files to be merged.

See this answer as an example.

.gitattributes

*.gz merge=keepTheir

(based on "git command for making one branch like another")


Maybe you want to ignore the minified version because they are just a minified representation of the full files?

Include the filenames in /.gitignore and commit a change adding this file. Git will stop tracking changes to the minified de-facto-copies uselessly.

0

精彩评论

暂无评论...
验证码 换一张
取 消