What is git?
That simply means that it ensures that you can save your work (any coding project) at a particular point in time – versions. Each save is called, in git’s parlance, commit.
You can therefore load your project from any commit you’ve have done. In essence you’d be able to control the “versions” of of your project you want to work with.
One of the advantages of this practice (committing code) is that in an event of mishap – either due to a development flaw or mistake, you can simply load a previous version of your projects instead of starting from the scratch again.
Before you can use all the features of git, you’ll have to install and set it up in your Linux system. So let’s see how we’ll go about this.
Update your system
sudo apt-get update
Install git Software:
sudo apt-get install git
Check the version of git you just installed:
If you got git installed correctly you’d get an output similar to:
git version 2.3.2
First Time Configurations
Since you’ve git installed, it is now important to set some global variables. These variables are important because it helps git to identify who is making changes to a particular code-base.
And it will also help developers identify you would, maybe in the future, you want to contribute to other people’s codes. The most common form of identification are names (i.e. username) and email. You can set these configuration in git like this:
git config -–global user.name “John” git config –-global user.email “[email protected]”
Check the all your configuration values;
git config –list
Remember that the most important variables you should be concern about are username and email, especially at a beginner’s stage. Maybe later when you want to do intermediary to advanced stuffs you would probably have become familiar with the necessary configuration settings you might need.
When you need help!
To see an overview of the git sub-commands and syntax you can enter the command on the terminal:
git help -a
For git concept guide use:
git help -g
To see what you can do with the various git command (actions) or concepts you can simply the following format.
git help "command" git help "concept"
You can use git now on local computer to tract you projects/code changes.
You can download a git cheat-sheet to learn the most important git commands you can work with.