Git - config


After we install Git, we do find system level configuration file stored at

..\Git\etc\gitconfig
Access it using git config --system

We also can add or change User or global level configuration and Repo level configuration files.

Open Git bash and type in the below
git config --global --list
Initially it gives 'Unable to read config file; No such file'

git config --global user.name "Malathi Boggavarapu"
git config --global user.email "malathi.boggavarapu@evry.com"
git config --global --list - shows the global config file that was created with above info.
cat ~/.gitconfig - shows the content of file
git config --global core.editor vim - default editor which is used for opening files or commiting messages while working on git bash. Ex vim, Notepad, etc
git config --global help.autocorrect 1 - Ex: Correct autmatically when we type git statsu
git config --global color.ui auto - use colors for differentiating the chanegs in a file.
git config --global core.autocrlf true|false|input - (Windows - always set to true)
true - Converts character terminal line feeds to line feeds when we commit to remote repo and re-convert to linux line feeds to windows line feeds when we pull out the code from remote repo. Works only on text files not binary files
false - Converts character terminal line feeds to line feeds when we commit to remote repo and does not re-convert to linux line feeds to windows line feeds when we pull out the code from remote repo
input - Converts the character terminal line feeds of windows to line feeds of linux when we do commit. But when we pull out code from Mac for example, it converts the line feeds to corresponding mac line feeds

git config --global --list
cd [project_root]
cat .git/config
shows git config of local repo.
git config user.name 'Naresh' - Overrides the user.name in user or global config file.

config sources are hierarchial.
System level config can be overriden by user or global level config and user level config can be overriden to repo level config

Some useful commands
---------------------------------------

ls -la - Shows all the files with available permissions
echo "Hello Git" > ReadMe.txt
git diff dd6819..a15ec6 - First six letters of commit hashcode
git diff HEAD~1..HEAD - difference between first commit and latest commit
Git add -u - Adds only the updated files
touch file1.txt file2.txt - create new files
rm file2.txt - delete file
mv file1.txt new_file_name.txt - rename the file

Comments

Popular posts from this blog

Bash - Execute Pl/Sql script from Shell script

How to get client Ip Address using Java HttpServletRequest

How to install Portable JDK in Windows without Admin rights