3

We have multi-platform project, which generates binaries for few platforms say mac, windows, linux... Is it possible to force git to change encoding of all files to some particular platform (For example: Linux). So how to change file's line ending every time when users commit or push to remote repository?

6
  • Why would you ever want to change the encoding of a binary? Encoding is not applicable to binaries, only to text files. Commented Feb 8, 2013 at 11:23
  • Not for binary but we have configuration files...for which i want to force Commented Feb 8, 2013 at 11:26
  • For us, binary will never be in git repository. Commented Feb 8, 2013 at 11:27
  • Are you talking about line endings or encoding (like UTF-8)? Commented Feb 8, 2013 at 11:46
  • Have you had a look at the setting core.autocrlf? Commented Feb 8, 2013 at 11:49

2 Answers 2

4

I guess you should use a git hook, check this scripts: Git companion scripts by yaegashi.

Sign up to request clarification or add additional context in comments.

Comments

2

I would recommend setting core.eol directives in .gitattributes file, rather than relying on a global config like core.autocrlf.

core.eol

Sets the line ending type to use in the working directory for files that have the text property set.
Alternatives are lf, crlf and native, which uses the platform's native line ending.
The default value is native.
See gitattributes(5) for more information on end-of-line conversion.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.