gitattributes

.gitattributes with core.autocrlf unset

北战南征 提交于 2019-12-04 13:06:49
问题 I have a .gitattributes file in my repository that looks like this * text=auto *.txt text I have unset core.autocrlf in the repository, global, and system settings. My understanding, based on the documentation for gitattributes, is that all files in the repository whose names end with .txt should be checked out with the native line endings. What I'm seeing, though, is that the .txt files always have LF for line endings, even on Windows. Given this configuration, why aren't the line endings

Apply multiple filters for same files in git

☆樱花仙子☆ 提交于 2019-12-04 10:17:28
I am using Git for version control of local files, which finally have to be checked in into another version control system. Now I am experiencing some problems with most of the C code files: They all have an automatic version history in their header comment Most of the files are cluttered by EasyCode or EasyCase comments I now simply created two git filters "History" and "EasyTool" to clean up the code before being checked in to Git. How is it possible to filter all C and H files with both of the filters? Specifying the commands multiple times does not work and concatenation of the filter

gitattributes not setting merge driver correctly

你。 提交于 2019-12-04 03:54:30
I have the following directory structure: project/ .git/ ... app/ ... config/ initializers/ braintree.rb environments/ production.rb .gitattributes My project uses two main branches, master and staging, each tracking a different remote (production and staging heroku apps). The idea is that the staging branch moves forward with new features, they get pushed to and tested on the staging remote, then master is fast-forwarded to match staging and pushed to the production remote. Here's what I want to do: freely merge these two branches while keeping their versions of braintree.rb and production.rb

What is difference between autocrlf and eol

不想你离开。 提交于 2019-12-03 21:41:00
I'm reading git documentation about .gitattributes to fix my problems with mixed line endings and find out that there is two similar settings. AUTOCRLF: End-of-line conversion While Git normally leaves file contents alone, it can be configured to normalize line endings to LF in the repository and, optionally, to convert them to CRLF when files are checked out. If you simply want to have CRLF line endings in your working directory regardless of the repository you are working with, you can set the config variable "core.autocrlf" without using any attributes. [core] autocrlf = true This does not

What does “*.jpg binary -delta” do in the .gitattributes file?

好久不见. 提交于 2019-12-03 20:47:28
This thread is suggesting placing *.jpg binary -delta in the .gitattribute file for repos in git but I am not sure what it does. I cannot find any examples of the '-delta' flag for git. The purpose is to apparently speed up commit or push times for larger files. VonC That could be related to: Packing objects delta Delta compression will not be attempted for blobs for paths with the attribute delta set to false. I detail delta storage in " Is the git binary diff algorithm (delta storage) standardized? ". That isn't set by default of binary files because: our originally intended target audience

Enforce core.autocrlf=input through .gitattributes

一个人想着一个人 提交于 2019-12-03 14:30:41
Is there a way to enforce core.autocrlf=input from within the .gitattributes in order to propagate the policy throughout my colleagues? In detail what I want is to convert to lf on add and leave as is on checkout . The problem is that neither text nor eol do what I want in .gitattributes since eol has 3 acceptable values: lf crlf native Ideally I would like my .gitattributes file to look like this: * text eol=asis In detail what I want is to convert to lf on commit and leave as is on checkout. Git doesn't convert on commit, but rather on git add . (More precisely, it does conversions on

git line endings : renormalize does not seem to checkout the right line endings

…衆ロ難τιáo~ 提交于 2019-12-03 14:05:45
I decided to set my line endings the Right Way via a .gitattributes file as detailed for instance here - so I set the core.autocrlf to false and created and committed a .gitattributes file : *.java text eol=native *.jsp text eol=native *.css text eol=native *.html text eol=native *.js text eol=native *.xml text eol=native *.sql text eol=native *.MF text eol=native # git files *.gitignore text eol=native *.gitattributes text eol=native #eclipse files *.classpath text eol=native *.project text eol=native *.prefs text eol=native *.properties text eol=native I then issued git rm --cached -r . and

How to automatically invoke a script before a git add?

孤者浪人 提交于 2019-12-03 11:48:50
Here's my use case: I commit PNGs and other stuff in my Git repo. I would like to apply a specific process to every PNGs I would like to commit and this is the result of the process I finally want to commit (the potential modified PNG). At the beginning I thought about a hook (like a pre-commit ) but it's a little weird because the process will change the file so I will need to re-add it! And according to what I read , there is no pre-add hook (or something like that). May be a solution is to create a git alias ? But I don't want to change - too much - the way people work, I'm searching for a

.gitattributes smudge and clean filters as a part of the repository

爷,独闯天下 提交于 2019-12-03 11:11:34
I have a number of template files in my git repository which change at different rates. These are then used to generate HTML pages. If someone reports a problem, I want them to be able to tell me which version of the template file has the problem. Currently, I manually enter the date into the file when I change it. Or, well, I try to. I forget most of the time. At least in theory, I should be able to use git smudge and clean filters to fix the files and insert the date of last update automatically. This would be great. Except that I develop on one machine, and when I'm ready, I push/pull to a

Git clean/smudge filters for ansible vault secrets

我与影子孤独终老i 提交于 2019-12-03 08:54:31
I am trying to setup clean/smudge filter in git to have automatic encrypting and decrypting of files containing secrets thru ansible-vault command. Peculiarity of the ansible-vault command is that it is not idempotent (it creates a different binary each time it is invoked on the same data). I started with the implementation suggested in this blog page . Unfortunately it did not work correctly, as whenever smudge is called (be it a git checkout , or just git status), the secret files looks as modified for git, even if it is not. So I wondered if git would be comparing the binary he has in the