Open In App

Introduction and Installation of Git

Version control system

A Version control system tracks any kind of changes made to the project file, why these changes were made, and references to the problems fixed or enhancements introduced. It allows developer teams to manage and track changes in code over time. It allows a person to switch to the previous states of the file, compare the versions and helps to identify issues in a file in a more efficient way. 
 



Git (A Version control system)

Git is one of the way of implementing the idea of version control. It is Distributed Version Control System(DVCS)



Unlike Centralized Version Control System that uses a central server to store all files and enables team collaboration, DVCS just can be implemented just with a help of a desktop, single software available at a command line. So the failure of the central server does not create any problem in DVCS. So a lot of operations can be performed when you are offline. 

Advantages of Git

Installing Git

Git for Windows 

Git for Mac OS X 

After Installing the git, we can customize it’s environment accordingly. The customization shall be done on any given computer. Git comes with a tool called git config that helps to set configuration variables, that look after the operation of git. In order to set these configuration values as global, add the –global option, and if you omit the –global option, then your configurations are specific for the current Git repository. Git can store configuration variables in three different following files: 

Note: Make use of Git UI tools only(Git bash, Gitk etc) whenever working with git. It is also important to set up your identity because git uses this information for every commit. 
 

Setting your username

$ git config --global user.name "Geek1234"

Setting your email-id

$ git config --global user.email geek1234@xyz.in

Setting your text editor

By default, git uses system’s default editor. This can be configured by:

$ git config --global core.editor 
"'C:/Program Files/Notepad++/notepad++.exe' -multiInst -nosession"
$ git config --global core.editor vim

Other editors such as emacs, sublime text editor etc can also be used. You need to follow specific instructions to set up an editor with it.  

Setting your merge tool

Git by default does not provide a merge tool for integrating conflicting changes into your work tree. We can set default merge tool by enabling following settings. 

$ git config --global merge.tool vimdiff 

Listing git settings

You can list your settings by using git config –list  

$ git config --list

This command will produce the following output:  

user.name=Geek1234
user.email=geek1234@xyz.in
color.status=auto
color.branch=auto
color.interactive=auto
color.diff=auto

 

Article Tags :