 Hello everyone, I am Rajna Pathak from Valchand Institute of Technology, Sallapur. Welcome to the session of Git. Learning outcome. At the end of the session, students will be able to explain the basic concepts of Git. Now, what are prerequisites for this session? We assume that you are going to use Git to handle all levels of Java and non-Java projects. So, it will be good if you have some amount of exposure to software development life cycle, that is SDLC and working knowledge of developing web-based and non-web-based applications. So, these are your prerequisites. Now, my question is that, can Git be used for all types of projects? So, please take a pause and try to think on it. Answer is yes. Of course, Git can be used for all types of projects. It can be your technical and it can be a non-technical project too. Now, what is Git? Introduction to your Git. These days, we all are hearing about Git and its advantages of using Git. If you are new to programming, these terms are frequently used in front of you by many programmers or you can say by many seniors. Now, question is why people are using it and how it works? I'll try to answer all your questions. Now, let us assume a situation where five people are working in a project and you want to manage so many stuffs. Now, is it so simple? No. The reason is you need to maintain so many versions and merging up all those modules. Now, how Git can help you out? Git works on the basic idea of distributed version control system. This idea is completely based on your SCM. That is your source code management system where you have to manage your source code. Now, let us see much in detail. Now, of course, Git was created by Linus Talwald. Yeah, he's the same creator of your Linux systems. Now, let us consider a simple example. Now, suppose you're working for a project, you get all basic requirements and you start working on it and prepare a structure. That is nothing but body of your project. Now, these user requirements and ideas keep on varying. So, at initial stage, you can see here, you are planning for a project. You think on it and you start creating a simple structure of your project. But before creating a structure, you need requirements. So, accordingly, you need to add many things, but sometimes your client may change his mind. Ask you for the previous developer project and here your Git comes into the picture. Git maintains the versions. It helps a complete track of your modifications and saves it as a different version. Now, what is Git? Git is created by Linus. Yes, he's the same guy who created your Linux kernel. Now, we got an idea that Git is merging of different source code from different people and maintain versions and this can be possible with the help of your Git. So, at initial stage, we can see we are collecting a requirement. We gather requirements from the user. Then you try to design a sample model. Your next step is you actually try to work on it. You create your source code, you prepare a model structure and you display or you show to your client. Now, what happens? Your client gives you some modification or he wants to add on so many things because your first actual work will never be approved. Of course, your client needs some modifications and when you add that modification, in case your client changes his mind and he wants the previous version, then what happens? You have to undo your modification. So, now the question is how is it possible? And your solution is with the help of your Git. So, here your Git comes into picture. You can create a source code. You can make copies of that source code with different modifications and sometimes we term it as okay. So, now we term it as versions. Now, let us see an example. Types of VCS that is types of your version control system. Centralized version control system that is nothing but your CVCS uses a central server to store all files and enables your team collaboration. But the major drawback, it is single point of failure. I mean failure of the central server can occur. Unfortunately, if your central server goes down for an hour or more than it, then you need to do so many changes. Nobody can collaborate at all. And sometimes even in a worst case, if the disk of the central server gets corrupted and proper backup has not been taken, then you will lose the entire history of your project. Now, this gives rise to distributed version control system. Now, what happens in case of your distributed version control system? Clients not only check out the latest modification of the directory, but they also fully mirror the repository. Okay, now repository means data structure where you store information. If the server goes down, then the repository from any client can be copied back to the server to restore whatever data is lost. Every checkout is a full of backup of that repository. Git does not rely on your central server and that is why you can perform many operations when you are offline or you have no internet connections. You can commit these changes, create branches, view logs, and perform other operations when you are offline. You just require your network connection only to publish your changes and take the latest changes. Now, let us see what are advantages of your Git. Free and open source. Git is released under GPL. That is nothing but your general public license, open source license. It is available freely over the internet. Now, you can use Git to manage proprietary projects without paying a single penny. As it is an open source, you can download its source code and also perform modifications according to your requirement. Another advantage is fast and small. As most of the operations are performed locally, it gives huge benefit in terms of speed. Git does not rely on central server. That is why there is no need to interact with the remote server for every operations performed. Now, though Git mirrors entire repository, the size of the data on the client side is small. Implicit backup. The chances of losing data are very rare when there are multiple copies of it. Data present on any client side mirrors the repository. So, this is one of the enhanced advantage. Another is your security. Git uses a common cryptographic hash function. You have heard about it. It is also called a secure hash function 1 to name and identify objects within its database. Every file and commit is checksum and retrieved by its checksum at the time of checkout. Now, this implies that it is impossible to change file, date and commit message and other data from the Git database without knowing to your Git. Easier branching. Now, when you talk about centralized version control system, which uses cheap copy mechanism, if we create a new branch, it will copy all the code to the new branch. So, it is time consuming and not efficient. Also, deletion and merging of branches in centralized version control system is more complicated and time consuming. But branching and managing with Git is very simple. It takes only a few seconds to create, delete and merge your branches. Now, you need not to use powerful hardware. For centralized version control system, central servers need to be more powerful enough to serve request of the entire team. For smaller team, it is not an issue. But when you talk about the team size and when it grows, the hardware limitation of the server can be performance bottleneck. Now, in case of your distributed system, developers don't interact with the server unless they need to push or pull any changes. All the heavy lifting happens only on the client side. So, the server hardware can be very simple. Now, let us see some terminologies. Local repository. Every VCS tool provides a private workplace as a working copy. Developers make changes in their private workplace and after commit, this changes become a part of that repository. Git takes it one step further by providing them a private copy of the whole repository. Users can perform so many operations with the repository such as adding file, removing, renaming, moving, commit changes and many more such. Another is your blob. Blob stands for binary large object. Each version of a file is represented by a blob. A blob holds the file data but doesn't contain any metadata. Now, let us see about trees. Tree is an object which represents your directory. It holds blob as a well. It carries sub-directories. A tree is nothing but a binary file that stores references to blob and trees which are always named as SHA1 hash of the tree object. Now, let us see what is commit. Commit holds the current state of your repository. Commit is also named by SHA1 hash. You can consider a commit object as a node of the linked list. Every commit object has a pointer to the parent commit object from a given commit. You can traverse back by looking at the parent pointer to view the history of your commit. Branches. Branches are used to create another line of development. Get by default has a master branch which is same as your trunk in sub-vergence. Usually, a branch is created to work on a new feature. Let us see about Clon. Clon is nothing but an operation that creates that instance of repository. Clon operation not only checks out the working copy but it also mirrors the complete repository. Users can perform many operations with this local repository. The only time your networking gets involved is when the repository instances are being synchronized. So, one more you have, pull and push. Pull operation is basically used when you need to download something from your repository. Pushing is for your uploading when you make some changes and you permanently want to store it in your Git repository you just perform push operations. Now these were your basic terminologies. Here are the references I have used during creation of this session. Thank you.