Git is an open source distributive version control system, we can also call Git as a type of Backup.
Git holds the history of all kind of operations which you have done in each updated versions, it also tracks the files, holds commit history, and allows you to make changes, undo changes you have made before.
Git allows one or more people to work as a team on the same project and we call this process as a collaboration.
Git also supports branching hence it will improve the quality of the project. and Git version controls nearly any kind of text-based files.
Most of the people who are using the version control system nowadays, the first most group of people are:
The above three groups obviously need a version control system for programming their source files as they use it for developing Java, Ruby, C, C++, objective c, etc.
And also a web designer group artist who wants to save their original art can also use Git version control system.
As we know Git is a distributed version control system, it allows most of the operations to be done on local, means it does not require any internet connection. and there are very few operations which require a network connection.
Because of its distributive nature, Git has a huge demand or scope in the software field. free and open source property also one of the main reason for its popularity.
We can also integrate Git with other tools like text editor, bug tracking system, and build servers which are used by developers.
Here we will go through the basic Git workflow and some basic key concepts.
The following three states are specific to the Local Git Repository.
A working directory is used to modify the files, where it is a directory or folder on the computer which contains all the project or application files.
The files within the working directory may or may not be controlled by the Git.
There will be a hidden folder called .git folder that contains the actual git repository.
The staging area is also called as Index, where the staging area holds /keep all the files which are in the queue for next commit.
The files which are present in the staging area are not committed yet. we can move the files in and out from the staging area without affecting the git repository and its history of changes.
Once you perform commit operation git sends files from staging area to the repository and once you complete the push operation it will permanently store the changes in the git repository.
Git Repository is the one which contains all the files with respect to the specific project application.
Git Repository also contains commit history and special configurations in it.
Github: It is Web-Based Hosting service mostly used for version control System through Git.
Now to understand the entire Git workflow in the local and Remote side we need to create a remote repository by using the GitHub and then we can replicate the remote repository in the local system.
Before we proceeding further with Git, we need to configure Git repository. Git Requires two information such as username and email id.
$ git config --global user.name "your username"
$ git config --global user.email "your email id"
$ git clone https://github.com/goldsi/github_demo.git
$ lsthen it will list all the files which are present in the project folder, then do
cd github_demo/you will be directed to the github_demo.
$ git statuscommand the repository tell us that it is on its master branch where the master branch is the default branch for Git Repository.
$ echo "test quick start" >> great.txt
$ cat great.txta command to see the content of the text file.
$ git add great.txt
$ git commit -m "adding text great txt file".
$ git push origin master