gitattributes

What will `* text=auto eol=lf` in gitattributes do?

不打扰是莪最后的温柔 提交于 2019-11-26 13:57:08
问题 We have this in our .gitattributes file: * text=auto eol=lf I'd like to precisely understand what this does. The first part is text=auto . From the documentation: This ensures that all files that Git considers to be text will have normalized (LF) line endings in the repository. The important part is that Git does the normalization only for files that it detects as text files. However, I'm not sure about the eol=lf part. I would think that it will also do the normalization only for text files

How to normalize working tree line endings in Git?

感情迁移 提交于 2019-11-26 12:51:33
问题 I have cloned a repository that had inconsistend line endings. I have added a .gitattributes that sets the text attribute for the files I want to normalize. Now when I commit changes I get the message: warning: CRLF will be replaced by LF in FILE. The file will have its original line endings in your working directory. How can I make git normalize my working copy of the file for me? Preferably I would like git to normalize the entire working tree. 回答1: With Git client 2.16 and higher there is

Where should I place my global 'gitattributes' file?

≯℡__Kan透↙ 提交于 2019-11-26 12:39:40
问题 I gather there is (despite the lack of documentation) a way to set Git attributes globally; but I\'m not clear where to place the necessary gitattributes file. The instructions say they belong in $(prefix)/etc/gitattributes But where is $(prefix) ? In particular, where would it be for OS X (with Git in /usr/local/git/bin/git )? Alternately (or in addition) would ~/.gitattributes work? 回答1: Global vs. system-wide settings There is some ambiguity in your question's terminology. In a Git context

How can I make git ignore future revisions to a file?

岁酱吖の 提交于 2019-11-26 12:35:10
问题 I have created a default version of a file included in a git repository. It\'s important that when someone clones the repository, they get a copy of this file. However, I would like to set git so that it ignores changes to this file later. .gitignore works only on untracked files. My motivation is that this file contains machine-specific information. I would like to provide default values, while allowing people to make local changes that won\'t get pushed back to the origin repository,

git smudge/clean filter between branches

前提是你 提交于 2019-11-26 04:51:55
问题 There are many related questions involving smudge/clean filters - I have spent some hours reading them, and trying various options, but still failing. I hope I can ask in a way that I get an answer that works for me. Specifically, I have read the page most of these answers link back to: Customizing Git - Git Attributes tl;dr Its a detailed question, but the summary is: Can I store DEBUG = false in a file on one branch, and DEBUG = true in another branch, using smudge/clean filters to manage