GIT stands for "Global Information Tracker".
There are different definitions for GIT. Listing out few of them here
Git is a free open-source version control system. This allows you to keep track of all changes throughout the code. This allows developers to collaborate and work together on the same codebase.
Git is a powerful and widely used version control system commonly used for software development and collaboration between developers.
GIT is a modern and widely used version control system. It is developed to manage the high speed and efficiency of projects. GIT allows developers to work together and monitor the same workspace.
Features of GIT
1. Open source: GIT is an open-source tool which anyone can use in local machine
2. Speed: Developers do git operations on their local repository so it provides a high speed.
3. Branching and Merging: GIT allows the creation of multiple branches without affecting one another. Creation, merging and deletion of branches take a few seconds only. In general, branches will be created environment/feature specific.
4. Staging: Staging acts as a preview of the next commit. It is called a staging area where commits can be formatted and reviewed before completion. this staging area can be considered as a place where Git stored the change.
5. Security: Files and commits are checked and retrieved by their checksum at the time of checkout. It stores its history in such a way that the ID of the commits depends on the complete development history leading up to that commit. Once it is published, one cannot make changes to its old version.
6. Maintain clean history: Git provides Git Rebase which is one of the most helpful features of GIT. It fetches the latest commits from the master branch and puts our code on top of that. Thus, it maintains a clean history of the project.
Benefits of GIT
One of the biggest advantages of GIT is its branching capabilities. Unlike other VCS, GIT branches are cheap and easy to merge.
VCS keeps track of every modification to the code. If developers make a mistake, they can compare it with an earlier version of the code which helps to fix the mistake.
Supports offline working if any internet connectivity issues are there it will not affect the work. Everything can be done locally.
Parallel development is allowed and helps in faster releases
Git allows us to track changes, so that we can check the status and compare files or branches.
Git ‘config’ Commands
Git config commands change the configuration options in Git installation. It is used to set your GIT email, editor name and alias you want to use with the git command.
When starting with GIT there is some setup that is needed. This is the one-time configuration on the computer.
In this tutorial, we will come across how to set up git using git config commands.
Git config command
The git config command sets the configuration values of your git installation.
This command updates the content of Git config files. Config files store information like username, editor details and email to associate with the commits.
Let's discuss five configuration topics:
Git configuration levels
List config files
Username setup
Email address setup
Alias setup
Git configuration levels:
Configuration values can be set at three different levels
- local: Local values will be applied to the repository in which the git config command is executed.
Values are stored in .git/config inside a repository.
- system: System values are applied to all users on a machine. You should set system level configuration values with caution because it may alter existing configurations.
Values stored in /etc/gitconfig on Linux
- global: Global values are applied to a particular user on an OS.
Values stored à ~/.gitconfig file in the home directory.
Global level settings are configured at the first Git setup time.
List/view the Git configuration file
Using git config commands, you can view an individual configuration value. If this is the first time Git is installed, until the config setup is done these commands will not display results
git config user.name <<username>>
This returns the user name that is configured
git config --list
Returns all the configuration values that are associated with the Git installation
Execute these commands before set up and also at the end of this tutorial to see the values that are configured by us.
Git username setup
To set the Git username, execute the below command. This username is not needed to be the same as your version control username.
git config --global user.name <<username>>
ex: git config--global user.name “Anu Jahnavi”
This will set the user name to ‘Anu Jahnavi’. All further commits will use this.
--global is used to set this default git config to all the repositories owned by the user.
Git config email address setup
To configure the Git email address execute the below command.
git config --global user.email <<emailaddress>>
Open ~/.gitconfig file and check the configured values
For example: git config --global user.email anu.jahnavi@email.com
Git config alias setup
Git aliases are used as shortcuts for repeated common commands.
For example - git commit can be written as git co
Here is the git alias for the git commit command
git config --global alias.co commit
To conclude
Git is used as a version control system and git config commands are used for configuration settings for the installed Git. Will discuss more on Git in next article.
Before you leave
Thank you for reading this article and I hope you found it helpful. If yes, please share this with your friends.
Please leave a like for this article. I will regularly post content here, please do follow. Thank you. ❤️