Git stores all global configurations in . gitconfig file, which is located in your home directory. To set these configuration values as global, add the --global option, and if you omit --global option, then your configurations are specific for the current Git repository. You can also set up system wide configuration.
You can force Git to read from and write to this file with the --local option. You can find this config file in the . git directory of whatever repository you're currently using. Anyone can view/edit these configuration settings.
git config is a powerful command in Git. You can use the Git configuration file to customize how Git works. This file exists in the project level where Git is initialized ( /project/. git/config ) or at the root level ( ~/.
The git config core. autocrlf command is used to change how Git handles line endings. It takes a single argument. On macOS, you simply pass input to the configuration. For example: $ git config --global core.autocrlf input # Configure Git to ensure line endings in files you checkout are correct for macOS.
Never turn autocrlf
on, it causes nothing but headaches and sorrows.
There's no excuse to use \r\n
on windows, all decent editors (by definition) can handle \n
.
I have reviewed that kind of config setting (crlf
) extensively in the question:
distributing git configuration with the code.
The conclusion was:
*.java +crlf *.txt +crlf ...
git status
, shell environment and svn import
(see "distributing git configuration with the code" for links and references).crlf
conversion altogether if you can.Now, regarding the specific issue of per-platform settings, branch is not always the right tool, especially for non-program related data (i.e; those settings are not related to what you are developing, only to the VCS storing the history of your development)
As stated in the question Git: How to maintain two branches of a project and merge only shared data?:
your life will be vastly simpler if you put the system-dependent code in different directories and deal with the cross-platform dependencies in the build system (Makefiles or whatever you use).
In this case, while branches could be use for system-dependent code, I would recommend directory for support tools system-dependent settings, with a script able to build the appropriate .gitattributes
file to apply the right setting depending on the repo deployment platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With