简体   繁体   中英

git pull with gzip files in repo?

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM