Git Commands

Git is a distributed source control repository. To get details knowledge on git visit official website.

Setting Up Git

At first if you want to use git you need to setup the basic git configuration. This is a one time only tasks and hence is important to set proper git configurations.

Git comes with a tool called git config that lets you get and set configuration variables that control all aspects of how Git looks and operates. These variables can be stored in three different places:

  1. /etc/gitconfig file: Contains values for every user on the system and all their repositories. If you pass the option --system to git config, it reads and writes from this file specifically.
  2. ~/.gitconfig or ~/.config/git/config file: Specific to your user. You can make Git read and write to this file specifically by passing the --global option.
  3. config file in the Git directory (that is, .git/config) of whatever repository you’re currently using: Specific to that single repository.


Your Identity

git config --global "<UserName>"
Given username has been set as global variant for all git commands you’ll use later.
git config --global <Email_Id>
Given email will be set as global variant for all git commits.

Note: If you pass the --global option, then Git will always use Continue reading