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
- Free and Open Source: Git is a free and Open source software system with which the users and programmers can edit, modify or reuse the software’s source code. It gives developers the opportunity to improve
- Instant Backup: Data can be instantly retrieved as there are several copies available.
- Effiecient and Low requirements
- Staging Area:This is an intermediate area where commits can be formatted and reviewed before completing the commit. We can manage which change is needed for which version of the file and stage them for different commit commands.
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 looks after operation of git. In order to set these configuration values as global, add the –global option, and if you omit –global option, then your configurations are specific for the current Git repository. Git can store configuration variables in three different following files:
- /etc/gitconfig: It is a file which contains configuration for every user and repository on the system. Since it is system wide configuration file, to configure these values one must have administrative permission to make changes. –system option can be used.
- ~/.gitconfig: This file contains user specific values. –global option can be used and all the repositories on the system can be configured.
- config file(current repository): It is the specific to a single repository (current). –local option can be used for making configurations.(If no option is used then it is by default –local).
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 firstname.lastname@example.org
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 following output:
user.name=Geek1234 email@example.com color.status=auto color.branch=auto color.interactive=auto color.diff=auto