{"id":266,"date":"2018-07-13T08:51:12","date_gmt":"2018-07-13T08:51:12","guid":{"rendered":"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=266"},"modified":"2019-05-16T08:33:14","modified_gmt":"2019-05-16T08:33:14","slug":"version-control-system-git","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/chapter\/version-control-system-git\/","title":{"rendered":"Version Control System &#8211; GIT"},"content":{"raw":"<div><span style=\"float: right;\"><a href=\"https:\/\/youtu.be\/mcxidQEKPOg\" target=\"_blank\" rel=\"noopener\"><img src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a>\r\n<\/span><\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\"><strong>Introduction<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Programmers develop software on daily basis. Every day, they add more code to the existing program. So, the software keeps on evolving. To manage the changes made in the software on periodic basis, version control systems were developed. Imagine there is a team of developers working on the same project. When each programmer starts submitting their code, it will become difficult to track who submitted the code and when. In case, if we want to rollback to the earlier version, it will be difficult in simple file based system. The version control system manages the\u00a0<span style=\"text-align: initial; font-size: 1em;\">changes made to system and if need arises, restores to some previous recall point. Although there are many version control system like CVS, Subversion, Perforce, Bazaar, and so on, GIT is an open source distributed version control system, we will study the GIT software in the module.<\/span><\/p>\r\n\r\n<\/div>\r\n<strong>Version Control System<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Version control system records changes to a file or set of files over time so that we can recall specific versions later on when required. A version control system keeps track of all changes made to a project. It allows many users to work in large teams on very complex projects while minimizing the conflicts between changes. Version control systems are necessary while developing software in teams. Each team member can have their own working copy of the project code without interfering with other developer\u2019s copies or the main trunk.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center;\"><strong><img class=\"size-full wp-image-267 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/9.jpg\" alt=\"\" width=\"1400\" height=\"540\" \/><\/strong><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 1: Version control system \u2013 Local, Centralized &amp; Distributed(Image source: https:\/\/git-scm.com\/book\/en\/v2)<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Few widely used version control systems include CVS (Concurrent Versions System), SVN (Apache Subversion), Git, etc. CVS is mostly a legacy system; SVN is a centralized system while Git is a decentralized system. Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. There can be multiple servers that can act as repositories, but each copy on each developer\u2019s own system is also a complete revision copy. Each team member can have their own working copy of the project code without interfering with other developer\u2019s copies or the main trunk.<\/p>\r\n&nbsp;\r\n\r\n<strong>Overview of GIT<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Development of Git was initiated by Linus Torvalds in 2005. Git is written in C, Shell, Perl, Tcl and Python, Git supports OS like Linux, Windows, MacOS. Git is released under GNU GPLv2 and GNU LGPL License. GitHub is a web-based Git or version control repository and Internet hosting service. It offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its own features. It provides access control and several collaboration features such as bug tracking, feature requests, task management, and wikis for every project.<\/p>\r\n&nbsp;\r\n\r\n<strong>Installation of GIT<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">GIT software is available for various platforms like Linux, MacOS, Windows and Solaris. Let us explore how to install GIT in our system.<\/p>\r\n&nbsp;\r\n\r\n<img class=\"size-full wp-image-268 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1111111111.jpg\" alt=\"\" width=\"1201\" height=\"689\" \/>\r\n<p style=\"text-align: center;\"><strong>Figure 1: git software installation<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">For Windows, GIT can be downloaded from the website <a href=\"http:\/\/git-scm.com\/downloads\">http:\/\/git-scm.com\/downloads, <\/a>The software is an installer file which can be installed in windows. Git has its own bash prompt and a command prompt. To install GIT in Linux, we must type the following commands at command prompt for Ubuntu based distribution and Red Hat based distributions respectively:<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-270 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/17.png\" alt=\"\" width=\"653\" height=\"171\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">We must enter our name and email address (highlighted in red color) while configuring git. The above command will create a single repository on our local system.<\/p>\r\n&nbsp;\r\n\r\n<strong>GitHub.com<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">GitHub is a web-based Git or version control repository and Internet hosting service. It offers all of the distributed version control and source code management (SCM) functionality of git. It provides access control and several collaboration features such as bug tracking, feature requests, task management, and wikis for every project. GitHub.com allows us to share our open source code with others by creating a repository over internet. It is a hosting service, where it is free for open source software, however, those who want to create private repositories that is not visisble to others need to pay to maintain their private repository.<\/p>\r\n&nbsp;\r\n\r\nGithub allows to:\r\n<ul>\r\n \t<li>Share our repositories with others<\/li>\r\n \t<li>Access other users repositories<\/li>\r\n \t<li>Store remote copies of our repositories (on Github server) in case if something goes wrong<\/li>\r\n<\/ul>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-271 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/22222222222.jpg\" alt=\"\" width=\"800\" height=\"532\" \/><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 2: Using local and remote repository<\/strong><\/p>\r\n<p style=\"text-align: center;\">\u00a0<img class=\"size-full wp-image-273 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/5555.jpg\" alt=\"\" width=\"1385\" height=\"747\" \/><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 3: Screen after signing up at GitHub.com<\/strong><\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-274 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/66666.jpg\" alt=\"\" width=\"1329\" height=\"717\" \/><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 4: Creation of repository at GitHub.com<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Figure 4 illustrates creation of repository on GitHub.com. We are creating a public repository with the name \u201cmyfirsrepo\u201d. The login name used is epgpathshalademo. We can initialize the repository from this screen.<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-275 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/232323.jpg\" alt=\"\" width=\"1085\" height=\"587\" \/><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 5: Repositories in our login at GitHub.com<\/strong><\/p>\r\n&nbsp;\r\n\r\nAs demonstrated in figure 5, we can see that there are 3 different repositories, these repositories are:\r\n<ul>\r\n \t<li>myfirstrepo (created by us)<\/li>\r\n \t<li>gir (forked repository)<\/li>\r\n \t<li>Jung (forked repository)<\/li>\r\n<\/ul>\r\n<p style=\"text-align: justify;\">Using GitHub.com, we can add other repository in our account. This process is known as forking. So, when we click on fork icon available on others repository, the code will be copied in our login.<\/p>\r\n&nbsp;\r\n\r\n<strong>Creating a local repository and synchronizing it with GitHub.com<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">In this section, let us create a local repository on our machine and we will see how to synchronize our local repository with the public repository available at GitHub.com.<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-276 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/323232.png\" alt=\"\" width=\"625\" height=\"152\" \/><\/p>\r\n<p style=\"text-align: justify;\">Using the above mentioned commands, we are creating a local repository and connecting it with the GitHub.com repository. The steps are:<\/p>\r\n&nbsp;\r\n\r\n1) Create a directory with the name of repository name\r\n\r\n2) Change to the newly created directory\r\n\r\n3) Initialize the repository (this will create a .git hidden direcroty)\r\n<p style=\"text-align: justify;\">4) By issuing the command $git remote add origin &lt;pathname&gt;, we are connecting our local repository with the remote repository.<\/p>\r\n<p style=\"text-align: justify;\">Now let us see how to push the files to remote repository. Suppose that our source code is residing in some folder, we change directory to that folder and issue the following commands:<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-277 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled.png\" alt=\"\" width=\"655\" height=\"98\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The first command in above code will add all files to local git repository, then after committing the repository, we push the files to remote repository using git push command. The following figure shows the output of performing push command, the screen shot is of GitHub.com website where it shows that our c programs and a header file have been pushed to remote repository.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-278 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled11.jpg\" alt=\"\" width=\"1178\" height=\"444\" \/><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 6: Source code pushed to Remote Repository<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>Cloning \/ Downloading the repository<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Suppose we want to download an entire project from the website GitHub.com, we can either use the GUI to download from the website or we can issue the clone command from command prompt.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-279 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2.jpg\" alt=\"\" width=\"1416\" height=\"416\" \/><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 7: Downloading a repository from GitHub.com<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The syntax to download a repository from GitHub.com and the command to download the repository indicated in figure is as shown below:<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-280 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2323232.png\" alt=\"\" width=\"657\" height=\"74\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The website GitHub.com has various open source projects hosted on it. Many students upload their assignments, few of them upload books, sample code, etc. on GitHub.com website.<\/p>\r\nLet us summarize what we have learnt in this module:\r\n<ul>\r\n \t<li>Understood the meaning of version control system<\/li>\r\n \t<li>Got an overview of Git software<\/li>\r\n \t<li>How to upload source code and download source code using GitHub.com<\/li>\r\n<\/ul>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>you can view video on Version Control System - GIT<\/strong><\/td>\r\n<td><a href=\"https:\/\/youtu.be\/mcxidQEKPOg\" target=\"_blank\" rel=\"noopener\"><img class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n<strong>\u00a0 \u00a0 References:<\/strong>\r\n<ul>\r\n \t<li style=\"text-align: justify;\">Eric. Pidoux. 2014. <em>Git Best Practices Guide.<\/em>, Packt Publishing.<\/li>\r\n \t<li style=\"text-align: justify;\">Donald Wexler. <em>Getting Started with GIT<\/em>,<\/li>\r\n \t<li style=\"text-align: justify;\"><em>Git\u202f: Distributed Version Control\u202f:<\/em><em style=\"text-align: initial; font-size: 1em;\">Fundamentals and Workflows<\/em><span style=\"text-align: initial; font-size: 1em;\">, Brainy Software.<\/span><\/li>\r\n \t<li style=\"text-align: justify;\">Aske. Olsson and Rasmus. Voss. 2014. <em>Git version control cookbook<\/em>, Packt Publishing.<\/li>\r\n \t<li style=\"text-align: justify;\">Emma Jane Hogbin Westby. <em>Git for teams<\/em>,<\/li>\r\n \t<li style=\"text-align: justify;\">Jon. Loeliger and Matthew (Matthew J... McCullough. 2012. <em>Version control with Git<\/em>,<\/li>\r\n \t<li style=\"text-align: justify;\">Ravishankar. Somasundaram. 2013. <em>Git\u202f: version control for everyone\u202f: the non-coder\u2019s guide for everyday version control for increased efficiency and productivity\u202f: beginner\u2019s guide<\/em>, Packt Publishing.<\/li>\r\n \t<li style=\"text-align: justify;\">Shaumik Daityari. <em>Jump start Git<\/em>,<\/li>\r\n \t<li style=\"text-align: justify;\">Scott Chacon and Ben Straub. <em>Pro Git<\/em>, Apress (Download: https:\/\/git-scm.com\/book\/en\/v2)<\/li>\r\n \t<li style=\"text-align: justify;\">Github Website: www.github.com<\/li>\r\n<\/ul>","rendered":"<div><span style=\"float: right;\"><a href=\"https:\/\/youtu.be\/mcxidQEKPOg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a><br \/>\n<\/span><\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><strong>Introduction<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Programmers develop software on daily basis. Every day, they add more code to the existing program. So, the software keeps on evolving. To manage the changes made in the software on periodic basis, version control systems were developed. Imagine there is a team of developers working on the same project. When each programmer starts submitting their code, it will become difficult to track who submitted the code and when. In case, if we want to rollback to the earlier version, it will be difficult in simple file based system. The version control system manages the\u00a0<span style=\"text-align: initial; font-size: 1em;\">changes made to system and if need arises, restores to some previous recall point. Although there are many version control system like CVS, Subversion, Perforce, Bazaar, and so on, GIT is an open source distributed version control system, we will study the GIT software in the module.<\/span><\/p>\n<\/div>\n<p><strong>Version Control System<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Version control system records changes to a file or set of files over time so that we can recall specific versions later on when required. A version control system keeps track of all changes made to a project. It allows many users to work in large teams on very complex projects while minimizing the conflicts between changes. Version control systems are necessary while developing software in teams. Each team member can have their own working copy of the project code without interfering with other developer\u2019s copies or the main trunk.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><strong><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-267 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/9.jpg\" alt=\"\" width=\"1400\" height=\"540\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/9.jpg 1400w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/9-300x116.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/9-768x296.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/9-1024x395.jpg 1024w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/9-65x25.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/9-225x87.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/9-350x135.jpg 350w\" sizes=\"auto, (max-width: 1400px) 100vw, 1400px\" \/><\/strong><\/p>\n<p style=\"text-align: center;\"><strong>Figure 1: Version control system \u2013 Local, Centralized &amp; Distributed(Image source: https:\/\/git-scm.com\/book\/en\/v2)<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Few widely used version control systems include CVS (Concurrent Versions System), SVN (Apache Subversion), Git, etc. CVS is mostly a legacy system; SVN is a centralized system while Git is a decentralized system. Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. There can be multiple servers that can act as repositories, but each copy on each developer\u2019s own system is also a complete revision copy. Each team member can have their own working copy of the project code without interfering with other developer\u2019s copies or the main trunk.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Overview of GIT<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Development of Git was initiated by Linus Torvalds in 2005. Git is written in C, Shell, Perl, Tcl and Python, Git supports OS like Linux, Windows, MacOS. Git is released under GNU GPLv2 and GNU LGPL License. GitHub is a web-based Git or version control repository and Internet hosting service. It offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its own features. It provides access control and several collaboration features such as bug tracking, feature requests, task management, and wikis for every project.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Installation of GIT<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">GIT software is available for various platforms like Linux, MacOS, Windows and Solaris. Let us explore how to install GIT in our system.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-268 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1111111111.jpg\" alt=\"\" width=\"1201\" height=\"689\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1111111111.jpg 1201w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1111111111-300x172.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1111111111-768x441.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1111111111-1024x587.jpg 1024w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1111111111-65x37.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1111111111-225x129.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1111111111-350x201.jpg 350w\" sizes=\"auto, (max-width: 1201px) 100vw, 1201px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 1: git software installation<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">For Windows, GIT can be downloaded from the website <a href=\"http:\/\/git-scm.com\/downloads\">http:\/\/git-scm.com\/downloads, <\/a>The software is an installer file which can be installed in windows. Git has its own bash prompt and a command prompt. To install GIT in Linux, we must type the following commands at command prompt for Ubuntu based distribution and Red Hat based distributions respectively:<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-270 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/17.png\" alt=\"\" width=\"653\" height=\"171\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/17.png 653w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/17-300x79.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/17-65x17.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/17-225x59.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/17-350x92.png 350w\" sizes=\"auto, (max-width: 653px) 100vw, 653px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">We must enter our name and email address (highlighted in red color) while configuring git. The above command will create a single repository on our local system.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>GitHub.com<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">GitHub is a web-based Git or version control repository and Internet hosting service. It offers all of the distributed version control and source code management (SCM) functionality of git. It provides access control and several collaboration features such as bug tracking, feature requests, task management, and wikis for every project. GitHub.com allows us to share our open source code with others by creating a repository over internet. It is a hosting service, where it is free for open source software, however, those who want to create private repositories that is not visisble to others need to pay to maintain their private repository.<\/p>\n<p>&nbsp;<\/p>\n<p>Github allows to:<\/p>\n<ul>\n<li>Share our repositories with others<\/li>\n<li>Access other users repositories<\/li>\n<li>Store remote copies of our repositories (on Github server) in case if something goes wrong<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-271 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/22222222222.jpg\" alt=\"\" width=\"800\" height=\"532\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/22222222222.jpg 800w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/22222222222-300x200.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/22222222222-768x511.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/22222222222-65x43.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/22222222222-225x150.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/22222222222-350x233.jpg 350w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 2: Using local and remote repository<\/strong><\/p>\n<p style=\"text-align: center;\">\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-273 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/5555.jpg\" alt=\"\" width=\"1385\" height=\"747\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/5555.jpg 1385w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/5555-300x162.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/5555-768x414.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/5555-1024x552.jpg 1024w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/5555-65x35.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/5555-225x121.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/5555-350x189.jpg 350w\" sizes=\"auto, (max-width: 1385px) 100vw, 1385px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 3: Screen after signing up at GitHub.com<\/strong><\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-274 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/66666.jpg\" alt=\"\" width=\"1329\" height=\"717\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/66666.jpg 1329w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/66666-300x162.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/66666-768x414.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/66666-1024x552.jpg 1024w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/66666-65x35.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/66666-225x121.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/66666-350x189.jpg 350w\" sizes=\"auto, (max-width: 1329px) 100vw, 1329px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 4: Creation of repository at GitHub.com<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Figure 4 illustrates creation of repository on GitHub.com. We are creating a public repository with the name \u201cmyfirsrepo\u201d. The login name used is epgpathshalademo. We can initialize the repository from this screen.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-275 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/232323.jpg\" alt=\"\" width=\"1085\" height=\"587\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/232323.jpg 1085w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/232323-300x162.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/232323-768x415.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/232323-1024x554.jpg 1024w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/232323-65x35.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/232323-225x122.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/232323-350x189.jpg 350w\" sizes=\"auto, (max-width: 1085px) 100vw, 1085px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 5: Repositories in our login at GitHub.com<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>As demonstrated in figure 5, we can see that there are 3 different repositories, these repositories are:<\/p>\n<ul>\n<li>myfirstrepo (created by us)<\/li>\n<li>gir (forked repository)<\/li>\n<li>Jung (forked repository)<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">Using GitHub.com, we can add other repository in our account. This process is known as forking. So, when we click on fork icon available on others repository, the code will be copied in our login.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Creating a local repository and synchronizing it with GitHub.com<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">In this section, let us create a local repository on our machine and we will see how to synchronize our local repository with the public repository available at GitHub.com.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-276 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/323232.png\" alt=\"\" width=\"625\" height=\"152\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/323232.png 625w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/323232-300x73.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/323232-65x16.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/323232-225x55.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/323232-350x85.png 350w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/p>\n<p style=\"text-align: justify;\">Using the above mentioned commands, we are creating a local repository and connecting it with the GitHub.com repository. The steps are:<\/p>\n<p>&nbsp;<\/p>\n<p>1) Create a directory with the name of repository name<\/p>\n<p>2) Change to the newly created directory<\/p>\n<p>3) Initialize the repository (this will create a .git hidden direcroty)<\/p>\n<p style=\"text-align: justify;\">4) By issuing the command $git remote add origin &lt;pathname&gt;, we are connecting our local repository with the remote repository.<\/p>\n<p style=\"text-align: justify;\">Now let us see how to push the files to remote repository. Suppose that our source code is residing in some folder, we change directory to that folder and issue the following commands:<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-277 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled.png\" alt=\"\" width=\"655\" height=\"98\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled.png 655w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled-300x45.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled-65x10.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled-225x34.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled-350x52.png 350w\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The first command in above code will add all files to local git repository, then after committing the repository, we push the files to remote repository using git push command. The following figure shows the output of performing push command, the screen shot is of GitHub.com website where it shows that our c programs and a header file have been pushed to remote repository.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-278 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled11.jpg\" alt=\"\" width=\"1178\" height=\"444\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled11.jpg 1178w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled11-300x113.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled11-768x289.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled11-1024x386.jpg 1024w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled11-65x24.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled11-225x85.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled11-350x132.jpg 350w\" sizes=\"auto, (max-width: 1178px) 100vw, 1178px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 6: Source code pushed to Remote Repository<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Cloning \/ Downloading the repository<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Suppose we want to download an entire project from the website GitHub.com, we can either use the GUI to download from the website or we can issue the clone command from command prompt.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-279 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2.jpg\" alt=\"\" width=\"1416\" height=\"416\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2.jpg 1416w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2-300x88.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2-768x226.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2-1024x301.jpg 1024w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2-65x19.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2-225x66.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2-350x103.jpg 350w\" sizes=\"auto, (max-width: 1416px) 100vw, 1416px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 7: Downloading a repository from GitHub.com<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The syntax to download a repository from GitHub.com and the command to download the repository indicated in figure is as shown below:<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-280 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2323232.png\" alt=\"\" width=\"657\" height=\"74\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2323232.png 657w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2323232-300x34.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2323232-65x7.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2323232-225x25.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Untitled2323232-350x39.png 350w\" sizes=\"auto, (max-width: 657px) 100vw, 657px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The website GitHub.com has various open source projects hosted on it. Many students upload their assignments, few of them upload books, sample code, etc. on GitHub.com website.<\/p>\n<p>Let us summarize what we have learnt in this module:<\/p>\n<ul>\n<li>Understood the meaning of version control system<\/li>\n<li>Got an overview of Git software<\/li>\n<li>How to upload source code and download source code using GitHub.com<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr>\n<td><strong>you can view video on Version Control System &#8211; GIT<\/strong><\/td>\n<td><a href=\"https:\/\/youtu.be\/mcxidQEKPOg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u00a0 \u00a0 References:<\/strong><\/p>\n<ul>\n<li style=\"text-align: justify;\">Eric. Pidoux. 2014. <em>Git Best Practices Guide.<\/em>, Packt Publishing.<\/li>\n<li style=\"text-align: justify;\">Donald Wexler. <em>Getting Started with GIT<\/em>,<\/li>\n<li style=\"text-align: justify;\"><em>Git\u202f: Distributed Version Control\u202f:<\/em><em style=\"text-align: initial; font-size: 1em;\">Fundamentals and Workflows<\/em><span style=\"text-align: initial; font-size: 1em;\">, Brainy Software.<\/span><\/li>\n<li style=\"text-align: justify;\">Aske. Olsson and Rasmus. Voss. 2014. <em>Git version control cookbook<\/em>, Packt Publishing.<\/li>\n<li style=\"text-align: justify;\">Emma Jane Hogbin Westby. <em>Git for teams<\/em>,<\/li>\n<li style=\"text-align: justify;\">Jon. Loeliger and Matthew (Matthew J&#8230; McCullough. 2012. <em>Version control with Git<\/em>,<\/li>\n<li style=\"text-align: justify;\">Ravishankar. Somasundaram. 2013. <em>Git\u202f: version control for everyone\u202f: the non-coder\u2019s guide for everyday version control for increased efficiency and productivity\u202f: beginner\u2019s guide<\/em>, Packt Publishing.<\/li>\n<li style=\"text-align: justify;\">Shaumik Daityari. <em>Jump start Git<\/em>,<\/li>\n<li style=\"text-align: justify;\">Scott Chacon and Ben Straub. <em>Pro Git<\/em>, Apress (Download: https:\/\/git-scm.com\/book\/en\/v2)<\/li>\n<li style=\"text-align: justify;\">Github Website: www.github.com<\/li>\n<\/ul>\n","protected":false},"author":4,"menu_order":17,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["mr-hardik-joshi"],"pb_section_license":""},"chapter-type":[],"contributor":[58],"license":[],"class_list":["post-266","chapter","type-chapter","status-publish","hentry","contributor-mr-hardik-joshi"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters\/266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/users\/4"}],"version-history":[{"count":10,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters\/266\/revisions"}],"predecessor-version":[{"id":696,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters\/266\/revisions\/696"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters\/266\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/media?parent=266"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapter-type?post=266"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/contributor?post=266"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/license?post=266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}