Git - Configure tooling
Set-up the config file
Where is the global git config data stored?
To figure out the location of the config file, use this: git config --list --show-origin --show-scope
Location of .gitconfig
file in Windows: C:\Users\username\.gitconfig
If the file doesn’t exist and if you want git to create the file for you, run a command like this one:
git config --global user.name "explorer436"
Just paste this in the .gitconfig
file. https://github.com/explorer436/Dotfiles2/blob/master/.gitconfig
core.ignorecase
I’m developing a project on OS X Lion that is under Git version control. I had these lowercase directories and then later capitalized them (e.g. emailaddresses => EmailAddresses), but Git doesn’t seem to recognize the change. It still thinks the directories are lowercase when I run git ls-files and other commands.
What should I do to get Git to pick up on this change?
You can tell git to take account of the case by running
git config core.ignorecase false
What is merge.conflictStyle
?
- Specify the style in which conflicted hunks are written out to working tree files upon merge.
- The default is
merge
, which shows a<<<<<<<
conflict marker, changes made by one side, a=======
marker, changes made by the other side, and then a>>>>>>>
marker. - An alternate style,
diff3
, adds a|||||||
marker and the original text before the=======
marker.
Checking Your Settings
If you want to check your configuration settings, you can use the git config –list command to list all the settings Git can find at that point.
Line ending settings
From the page above:
Git allows you to set the line ending properties for a repo directly using the text attribute in the .gitattributes file. This file is committed into the repo and overrides the core.autocrlf setting, allowing you to ensure consistent behaviour for all users regardless of their git settings.
The advantage of this is that your end of line configuration now travels with your repository and you don’t need to worry about whether or not collaborators have the proper global settings.
There is a sample on the page above.
There is a convenient collection of ready to use .gitattributes files for the most popular programming languages. It’s useful to get you started.
Finally, the Mind the End of Your Line article provides more background and explains how Git has evolved on the matters at hand. I consider this required reading.
Reading material
https://spin.atomicobject.com/2020/05/05/git-configurations-default/