gitattributes

How to to disable Git end-of-line (CRLF to LF) across all clones/machines?

 ̄綄美尐妖づ 提交于 2019-11-29 19:48:13
As one can glean from other posts , Git's end-of-line normalization has its pros and cons. I have one particular Windows-only project where I think the best thing to do is to is to disable end-of-line normalization altogether. That is, I want to leave all newlines (most of which are CRLF ) intact, rather than have git normalize them to LF -only behind the scenes, and I want that change to affect all clones of the repository on all machines. The question is the most effective way to do it. Most discussions of Git end-of-line normalization are in terms of core.autocrlf , and I could accomplish

Problems with git reset --hard after adding .gitattribute — local changes that should not be there

岁酱吖の 提交于 2019-11-29 07:46:35
问题 I have observed CRLF problems after merging bundles from my colleague. Sometimes lines with LF were mixed into the sources, probably the ones that were merged into. Therefore, we have decided to add the .gitattributes file with the following content (comments removed): *.cpp text *.h text *.inc text *.cfg text *.dic text *.sln text eol=crlf *.vcxproj text eol=crlf *.filters text eol=crlf *.user text eol=crlf *.rc text eol=crlf *.rc2 text eol=crlf Now I observe the strange behaviour. I can see

git ignoring .gitattributes pattern

混江龙づ霸主 提交于 2019-11-29 06:53:21
I've a directory structure like this: root/ .git deploy/ Site/ blah/ more_blah/ something.local else.development Rakefile .gitattributes Edit: to further clarify the above, directories have a trailing / and children are indented beneath a directory, so blah and more_blah are directories but Rakefile and .gitattributes are files, but all four are children of Site . I'm running git-archive from the Site directory like so: git archive --format=tar --prefix=git-v0.0.1/ v0.0.1 | gzip > ../deploy/git-v0.0.1.tar.zip but whatever pattern I put in .gitattributes, the resulting archive always contains

How to to disable Git end-of-line (CRLF to LF) across all clones/machines?

风流意气都作罢 提交于 2019-11-28 16:18:51
问题 As one can glean from other posts, Git's end-of-line normalization has its pros and cons. I have one particular Windows-only project where I think the best thing to do is to is to disable end-of-line normalization altogether. That is, I want to leave all newlines (most of which are CRLF ) intact, rather than have git normalize them to LF -only behind the scenes, and I want that change to affect all clones of the repository on all machines. The question is the most effective way to do it. Most

git ignoring .gitattributes pattern

放肆的年华 提交于 2019-11-27 18:12:58
问题 I've a directory structure like this: root/ .git deploy/ Site/ blah/ more_blah/ something.local else.development Rakefile .gitattributes Edit: to further clarify the above, directories have a trailing / and children are indented beneath a directory, so blah and more_blah are directories but Rakefile and .gitattributes are files, but all four are children of Site . I'm running git-archive from the Site directory like so: git archive --format=tar --prefix=git-v0.0.1/ v0.0.1 | gzip > ../deploy

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

情到浓时终转凉″ 提交于 2019-11-27 08:01:32
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 but I can't find support for it in the documentation and we had an instance when our PNG files were

How to normalize working tree line endings in Git?

假如想象 提交于 2019-11-27 06:01:44
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. With Git client 2.16 and higher there is now a much simpler way to do this. Just use git add --renormalize . For those using v2.16 or better, you can

Where should I place my global 'gitattributes' file?

倖福魔咒の 提交于 2019-11-27 03:49:09
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 ? Global vs. system-wide settings There is some ambiguity in your question's terminology. In a Git context, "global" usually means "user-level"; in other words, a global setting affect all repositories for one

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

杀马特。学长 韩版系。学妹 提交于 2019-11-27 02:48:05
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, creating merge conflicts when we pull new changes. We are generally pretty lazy and use git add . a lot, so I'm

git smudge/clean filter between branches

非 Y 不嫁゛ 提交于 2019-11-26 18:58:41
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 that file? And how? Background I have various remote repos hosted at bitbucket. I am using SourceTree on