Introduction
Have you ever found yourself in a situation where you’ve developed a piece of software which runs smoothly, later on you add a new feature to your software, but unknowingly it starts behaving weird and you can’t figure out why?
In such a situation, the wiser thing would be to simply take your code back to the state where things were running fine and then find the root cause of the problem.
But how do you rollback the changes? How do you know which part of code was present in the stable version and which wasn’t?
To solve this problem we use Version Control System (VCS).
What is a Version Control System (VCS)?
A Version Control System (VCS) is a software that tracks the changes in your files and folders throughout its history of existence. Below are some of the Version Control Systems.
SVN
Mercurial
Git
For the scope of this article, we will keep our discussion limited to Git.
What is Git (and Github)?
Linus Torvald the creator of Linux along with the others built and released Git in 2005.
Git is a Version Control System (VCS) that helps you keep track of the changes in files and folders where it is initialized (We will see more about initialization in the later part of this article).
Github is a cloud code storing service that uses git. It is used to track, maintain and share your code with other developers. Developers can easily collaborate on the code stored on Github. Apart from from this Github is also useful in developing and using CI/CD pipelines for continuous integration and continuous deployment.
Therefore, Git and Github are different and you must not get confused between the two.
Git configuration commands
These commands are the first steps on getting started with git.
To configure your user name (this name will be shown against each commit) use the below command.
Syntax
git config --global user.name "Your Name"
Example
git config --global user.name "Biraj Singh"
Verify
git config --global user.name
Output
Biraj Singh
To configure your email address (this email will be used to connect to the remote repository) use the below command.
Syntax
git config --global user.email "your@email.com"
Example
git config --global user.email "code@birajsingh.com"
Verify
git config --global user.email
Output
code@birajsingh.com
To set the global editor to the editor of your choice, use the below command. By default it is vim.
Syntax
git config --global core.editor “command to invoke your code editor”
Example (- -wait is added to add a delay in the editor invocation)
git config --global core.editor “code --wait”
Verify
git config --global core.editor
Output
code --wait