{"id":1795,"date":"2021-02-03T10:53:43","date_gmt":"2021-02-03T08:53:43","guid":{"rendered":"https:\/\/modinst.lu.lv\/?p=1795"},"modified":"2021-02-03T15:47:15","modified_gmt":"2021-02-03T13:47:15","slug":"git-basics","status":"publish","type":"post","link":"https:\/\/modinst.lu.lv\/en\/git-basics\/","title":{"rendered":"Basics of Git version control"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">About the author<\/h2>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<p>Mg. Phys. Kristaps Bergfelds is a researcher at the Institute of Numerical Modelling (University of Latvia), where his daily duties include acquisition, processing, and plotting of scientific data. Additional to his research, Kristaps teaches programming for physics students (programming and data science basics using Python language). This article is based on Kristaps\u2019 experience and observation on the daily needs of his colleagues and students to collaborate in the development of various programming projects.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/01\/no_datiem_lidz_grafikam_0_par_autoru.jpg\" alt=\"\" class=\"wp-image-1534\" width=\"224\" height=\"224\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/01\/no_datiem_lidz_grafikam_0_par_autoru.jpg 781w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/01\/no_datiem_lidz_grafikam_0_par_autoru-300x300.jpg 300w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/01\/no_datiem_lidz_grafikam_0_par_autoru-80x80.jpg 80w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/01\/no_datiem_lidz_grafikam_0_par_autoru-768x768.jpg 768w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/01\/no_datiem_lidz_grafikam_0_par_autoru-36x36.jpg 36w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/01\/no_datiem_lidz_grafikam_0_par_autoru-180x180.jpg 180w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/01\/no_datiem_lidz_grafikam_0_par_autoru-705x705.jpg 705w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><\/figure><\/div>\n<\/div>\n<\/div>\n\n\n\n<p>Almost anyone who has collaborated with colleagues on creating a text report has encountered version control issues. Often you end up browsing and organizing such documents as <em>document.docx<\/em>, <em>document_final.docx<\/em>, <em>document_final_edited.docx<\/em>, <em>document_final_edited_2_really_completed.docx <\/em>etc. This process can be confusing, error-prone, and cumbersome for all those involved.<\/p>\n\n\n\n<p>To make this process easier, you can place the document in a place accessible to everyone and edit it collaboratively: either in the form of a cloud document (Google Drive, OneDrive, Dropbox) or in a shared local network folder. Versioning is available on these document sharing platforms so that you can restore an earlier version of your documents if necessary. Edit highlighting is also available to inspect exactly what has changed between versions.<\/p>\n\n\n\n<p>Programmers have been facing very similar problems since the beginning of software development itself &#8211; several developers need to interact during program code development, keep track of changes, test various elements of program code, and sometimes obtain earlier code versions. As with text documents, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_version-control_software\" target=\"_blank\" rel=\"noreferrer noopener\">several specialized tools<\/a> have been developed for controlling code versions, offering a variety of options for specific code development needs, such as the ability to create parallel code development paths and branched version structures.<\/p>\n\n\n\n<p>Currently, the <em>de facto<\/em> code versioning system standard among programmers is the <em>Git <\/em>platform. In addition to <a href=\"https:\/\/coderefinery.github.io\/git-intro\/01-motivation\/\" target=\"_blank\" rel=\"noreferrer noopener\">various technical advantages<\/a> and increasing popularity, supporting web-platforms (such as <em><a href=\"https:\/\/github.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub<\/a><\/em>, <em><a href=\"https:\/\/gitlab.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">GitLab<\/a><\/em>, <em><a href=\"https:\/\/bitbucket.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">BitBucket<\/a><\/em>) should be emphasized. Therefore, this article is devoted to the use of the <em>Git <\/em>platform specifically. <strong>This article is intended for <em>Windows <\/em>users who want to take advantage of the versioning system in a graphical interface (rather than through the command line).<\/strong><\/p>\n\n\n\n<p>The article provides an insight into the basic principles of using <em>Git<\/em>, shows the required software to be installed in the <em>Windows <\/em>environment, provides an insight into the sharing of <em>Git <\/em>repositories with the help of the <em>GitLab <\/em>portal. For further reading, it is highly recommended to use <a href=\"https:\/\/coderefinery.github.io\/git-intro\/\" target=\"_blank\" rel=\"noreferrer noopener\">this free tutorial<\/a> provided by the <a href=\"https:\/\/neic.no\/\" target=\"_blank\" rel=\"noreferrer noopener\">Nordic e-Infrastructure Collaboration (NeIC)<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting up <em>Git <\/em>on your computer and basic use of repositories<\/h2>\n\n\n\n<p>To start using the <em>Git <\/em>versioning system, you need to install <em><a href=\"https:\/\/gitforwindows.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Git for Windows<\/a><\/em> (keep all default settings during installation). Installing this program makes it possible to use <em>Git <\/em>only in the command-line interface. Further sections of this article will show you how to do this using a graphical interface, however, a brief demonstration of the command-line interface use is given here to illustrate the basics of <em>Git <\/em>and introduce some terminology.<\/p>\n\n\n\n<p>When you open the installed <em>Git <\/em>command line (<em>Git Bash<\/em>), execute the following commands to create a folder whose contents will be subject to versioning control (i.e., a <strong>repository <\/strong>will be created). The comments written on each line reveal the essence of the commands.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mkdir MyProject    # Create folder\n$ cd MyProject       # Change location to the new folder\n$ Git init           # Initialize repository\n<\/code><\/pre>\n\n\n\n<p>You can place\/create program code files in the folder using your usual tools. In the example below, the folder contains a <em>Python <\/em>script (<em>my_program.py<\/em>) that plots some mathematical expressions (<em>myplot.pdf<\/em>).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/6_project-1030x666.jpg\" alt=\"\" class=\"wp-image-1754\" width=\"689\" height=\"446\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/6_project-1030x666.jpg 1030w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/6_project-300x194.jpg 300w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/6_project-768x497.jpg 768w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/6_project-705x456.jpg 705w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/6_project.jpg 1387w\" sizes=\"auto, (max-width: 689px) 100vw, 689px\" \/><\/figure><\/div>\n\n\n\n<p>To preserve the current stage of<em> .py<\/em> script development in the versioning history, you need to execute commands that (1) add the file to the version control (<em>staging<\/em>) and (2) mark the changes made in the version history (<em>commit<\/em>).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git add my_program.py                    # Staging for version control\ngit commit -m \"Initial code development\" # Saving changes as a version\n<\/code><\/pre>\n\n\n\n<p>Once this is done, you can run the git status command to see what the current state of the repository is from the versioning system&#8217;s point of view. The command will show if changes have been made since the last version of the content was committed and if there are files that are not being tracked. In this example, the file myplot.pdf is not tracked, because it is the output of the developed script, the exact content of which is not important. It is important, however, to follow the code of the program that created it.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"581\" height=\"300\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/1_git_status.jpg\" alt=\"\" class=\"wp-image-1777\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/1_git_status.jpg 581w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/1_git_status-300x155.jpg 300w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/figure><\/div>\n\n\n\n<p>After changing the repository files (e.g., by continuing to develop the program code), the changes are saved by re-executing the already mentioned commands (<em>git add<\/em>, <em>git commit<\/em>). When you run the git log command, the version development history is displayed. This example shows that two submissions have been made (<em>\u2018Initial code development\u2019<\/em> and <em>\u2018Small edits\u2019<\/em>).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"581\" height=\"300\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/2_git_log.jpg\" alt=\"\" class=\"wp-image-1779\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/2_git_log.jpg 581w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/2_git_log-300x155.jpg 300w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/figure><\/div>\n\n\n\n<p>If you need to undo changes made to the repository, you can run the git restore command. There are many capabilities of <em>Git<\/em>: you can return the repository to its previous states, you can create parallel branches of development, you can temporarily examine older versions. However, using <em>Git <\/em>via the command line interface can be inconvenient, frustrating, and unfamiliar to regular <em>Windows <\/em>users. Therefore, further in this article we look at ways to use <em>Git <\/em>repositories through a graphical interface.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using <em>Git Extensions<\/em> for graphical experience<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Installation and configuration<\/h3>\n\n\n\n<p>To use the graphical interface to manage <em>Git <\/em>repositories in <em>Windows<\/em>, it is recommended to install <em><a href=\"http:\/\/gitextensions.github.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">Git Extensions<\/a><\/em>. To take full advantage of this program, you need to install two additional applications: (1) <em><a href=\"https:\/\/winmerge.org\/?lang=en\" target=\"_blank\" rel=\"noreferrer noopener\">WinMerge<\/a><\/em>, which will be used to visualize file changes, and (2) <em><a href=\"https:\/\/www.putty.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">PuTTY<\/a><\/em>, which will make it easier to work with remote repositories (e.g., <em>GitLab<\/em>).<\/p>\n\n\n\n<p>After installing <em>Git Extensions<\/em>, it is very important to configure all the required program settings &#8211; for this purpose, the program settings window offers a convenient checklist. Make sure all settings are shown as valid (green).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/3_gitext_settings.jpg\" alt=\"\" class=\"wp-image-1781\" width=\"609\" height=\"498\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/3_gitext_settings.jpg 952w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/3_gitext_settings-300x245.jpg 300w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/3_gitext_settings-768x628.jpg 768w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/3_gitext_settings-705x576.jpg 705w\" sizes=\"auto, (max-width: 609px) 100vw, 609px\" \/><\/figure><\/div>\n\n\n\n<p>In the <em>\u2018difftools\u2019<\/em> section select the <em>WinMerge <\/em>tool mentioned above. Additionally, select <em>\u2018PuTTY\u2019<\/em> in the<em> \u2018SSH\u2019<\/em> section of the settings.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Basic usage<\/h3>\n\n\n\n<p>After installing the programs and configuring all the settings, use the <em>Git <\/em>repositories without the help of the command line are now possible. In any <em>Windows <\/em>folder, a right-click reveals the options provided by <em>Git Extensions<\/em>: browse existing or create new repositories, copy (<em>clone<\/em>) the repository from another location (e.g., <em>GitLab<\/em>).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"271\" height=\"397\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/4_gitext_context.jpg\" alt=\"\" class=\"wp-image-1783\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/4_gitext_context.jpg 271w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/4_gitext_context-205x300.jpg 205w\" sizes=\"auto, (max-width: 271px) 100vw, 271px\" \/><\/figure><\/div>\n\n\n\n<p>In folders where repositories are already located, <em>&#8216;GitExt open repository&#8217;<\/em> command is available. This option opens a window where you can review the history of repository changes, see their authors and added comments.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"823\" height=\"541\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/5_gitext_browse.jpg\" alt=\"\" class=\"wp-image-1753\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/5_gitext_browse.jpg 823w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/5_gitext_browse-300x197.jpg 300w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/5_gitext_browse-768x505.jpg 768w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/5_gitext_browse-705x463.jpg 705w\" sizes=\"auto, (max-width: 823px) 100vw, 823px\" \/><\/figure><\/div>\n\n\n\n<p>You can click the <em>\u2018Commit\u2019 <\/em>button to create a version of the repository content similarly as shown previously in the command line example. However, in this case, an additional visualization is provided by the <em>Git Extensions<\/em> environment.<\/p>\n\n\n\n<p>A very valuable and frequently used option is to edit the<em> .gitignore <\/em>file (<em>Repository \/ Edit .gitignore<\/em>), which lists the files and filetypes whose changes to ignore and not subject to version control. In the example provided, PDF file output should be added here.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using <em>GitLab<\/em> for collaboration<\/h2>\n\n\n\n<p>So far, this article considered only local <em>Git <\/em>repositories. However, a significant advantage of using a versioning system is the ability to collaborate easily and transparently. That is why several <em>Git<\/em>-based Internet services have been created with the possibility to deploy and share remote repositories. This section demonstrates the use of one of such services: <em><a href=\"https:\/\/gitlab.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">GitLab.com<\/a><\/em>. It should be noted that the University of Latvia provides a <em>GitLab<\/em>-based platform <em><a href=\"https:\/\/git.lu.lv\/\" target=\"_blank\" rel=\"noreferrer noopener\">git.lu.lv<\/a><\/em>, which can be accessed with a <a href=\"https:\/\/luis.lu.lv\/lu\/\" target=\"_blank\" rel=\"noreferrer noopener\">LUIS<\/a> username and password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Registering and creating a repository<\/h3>\n\n\n\n<p>You can <a href=\"https:\/\/gitlab.com\/users\/sign_up\" target=\"_blank\" rel=\"noreferrer noopener\">register<\/a> on <em>GitLab <\/em>with an email or a Google account. The platform is free to use, but you need to notice and use the<em> &#8216;Skip Trial&#8217;<\/em> button during registration.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/9_free_trial.jpg\" alt=\"\" class=\"wp-image-1761\" width=\"371\" height=\"178\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/9_free_trial.jpg 753w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/9_free_trial-300x144.jpg 300w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/9_free_trial-705x338.jpg 705w\" sizes=\"auto, (max-width: 371px) 100vw, 371px\" \/><\/figure><\/div>\n\n\n\n<p>After successful account creation, it is possible to create remote repositories \u2013 specify the title, description, privacy level (private, shared to group, public) and other parameters.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Adding an SSH key<\/h3>\n\n\n\n<p>To upload (<em>git push<\/em>) the local repositories to the remote <em>GitLab <\/em>environment, as well as download (<em>git clone<\/em>) your private repositories, you need a way to authenticate your local computer to work with your <em>GitLab <\/em>account. SSH keys are used for this purpose.<\/p>\n\n\n\n<p>To enable this type of authentication, you need to create a pair of private and public SSH key. A private SSH key is nothing more than a very long and secure password. The SSH public key, on the other hand, is a publicly visible authentication token that matches this password. In fact, it would be more appropriate to call the public key a &#8216;lock&#8217; which the user can install in a place of his choice &#8211; in this case, his <em>GitLab <\/em>account.<\/p>\n\n\n\n<p>If you have the aforementioned <em>PuTTY <\/em>program installed on your computer, the <em>PuTTYgen <\/em>tool is available for you to easily create SSH key pairs. Following the instructions in the program window, it is possible to obtain both the private key (saved in a <em>.ppk<\/em> file) and the public key (it must be copy\/pasted to the <em>GitLab <\/em>portal section <em>User Settings \/ SSH Keys<\/em>).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"479\" height=\"471\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/10_puttygen.jpg\" alt=\"\" class=\"wp-image-1763\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/10_puttygen.jpg 479w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/10_puttygen-300x295.jpg 300w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/10_puttygen-80x80.jpg 80w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/10_puttygen-36x36.jpg 36w\" sizes=\"auto, (max-width: 479px) 100vw, 479px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Cloning remote repositories<\/h3>\n\n\n\n<p>To obtain a repository located on the <em>GitLab <\/em>portal (including newly created\/empty repositories), you need to copy its SSH address.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"526\" height=\"298\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/11_clone_gitlab.jpg\" alt=\"\" class=\"wp-image-1765\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/11_clone_gitlab.jpg 526w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/11_clone_gitlab-300x170.jpg 300w\" sizes=\"auto, (max-width: 526px) 100vw, 526px\" \/><\/figure><\/div>\n\n\n\n<p>On your computer, right-click within a folder and select the <em>GitExt Clone<\/em> command. You must specify the address obtained on the <em>GitLab <\/em>portal and select the appropriate private SSH key for your account. Press the <em>\u2018Clone\u2019 <\/em>button to copy the repository.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"618\" height=\"368\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/12_gitclone_local.jpg\" alt=\"\" class=\"wp-image-1767\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/12_gitclone_local.jpg 618w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/12_gitclone_local-300x179.jpg 300w\" sizes=\"auto, (max-width: 618px) 100vw, 618px\" \/><\/figure><\/div>\n\n\n\n<p>After the successful copy (<em>clone<\/em>) of the repository, you will be able to continue\/start working with its content as demonstrated previously. However, now, in addition to the <em>&#8216;Commit&#8217; <\/em>action discussed earlier, there is a<em> &#8216;Push&#8217;<\/em> action that uploads versions created in the local repository to the remote location. Similarly, you can perform a <em>&#8216;Pull&#8217; <\/em>action that will download changes made by others.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"586\" height=\"322\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/13_push_pull.jpg\" alt=\"\" class=\"wp-image-1769\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/13_push_pull.jpg 586w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/13_push_pull-300x165.jpg 300w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Cloning public repositories<\/h3>\n\n\n\n<p>If the repository is set to be public, anyone can download it (<em>git clone<\/em>) using the repository&#8217;s HTTPS address provided on the <em>GitLab <\/em>platform. In the example below, the <a href=\"https:\/\/gitlab.com\/Bergfelds\/myrepoexample\" target=\"_blank\" rel=\"noreferrer noopener\">public repository shown in this article<\/a> is downloaded to the INM High Performance Computing Cluster using the command line.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"791\" height=\"354\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/15_git_clone_hpc.jpg\" alt=\"\" class=\"wp-image-1773\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/15_git_clone_hpc.jpg 791w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/15_git_clone_hpc-300x134.jpg 300w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/15_git_clone_hpc-768x344.jpg 768w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/15_git_clone_hpc-705x316.jpg 705w\" sizes=\"auto, (max-width: 791px) 100vw, 791px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>This article provides an insight into working with local <em>Git <\/em>repositories in the <em>Windows <\/em>environment by using the<em> Git Extensions<\/em> GUI. Basics of using <em>GitLab <\/em>environment, creating remote repositories, performing clone\/push\/pull operations is also shown. However, the article does not discuss several advantages of the <em>Git <\/em>system, as well as the <em>GitLab <\/em>portal. At least one of them should be emphasized before closing this article: project documentation.<\/p>\n\n\n\n<p>In the <em>GitLab <\/em>repository interface, you can display the repository documentation using the <em>README.md<\/em> file. I.e., if the repository contains a text file named <em>README.md<\/em>, it will be previewed on the <em>GitLab <\/em>site. These documentation files can be formatted with <a href=\"https:\/\/guides.github.com\/features\/mastering-markdown\/\" target=\"_blank\" rel=\"noreferrer noopener\">various text markdown commands<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>* Nulla vel sem volutpat, volutpat sapien sed, egestas ligula.\n* _Vestibulum fermentum lectus et finibus volutpat._\n* __Vestibulum tristique turpis quis enim porta vestibulum.__\n* `Nam facilisis sapien vitae gravida ultricies.`\n* &#91;Nam commodo purus in faucibus fermentum.](https:\/\/modinst.lv)\n<\/code><\/pre>\n\n\n\n<p>The text formatting commands shown above, if placed in the <em>README.md<\/em> file, will be displayed on the <em>GitLab <\/em>portal as follows:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"492\" height=\"146\" src=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/14_formatted.jpg\" alt=\"\" class=\"wp-image-1771\" srcset=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/14_formatted.jpg 492w, https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/14_formatted-300x89.jpg 300w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/figure><\/div>\n\n\n\n<p>Hopefully, this article will help you to get started with <em>Git <\/em>and will allow you to collaborate more efficiently and quickly when working on code projects.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>About the author Mg. Phys. Kristaps Bergfelds is a researcher at the Institute of Numerical Modelling (University of Latvia), where his daily duties include acquisition, processing, and plotting of scientific data. Additional to his research, Kristaps teaches programming for physics students (programming and data science basics using Python language). This article is based on Kristaps\u2019 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":1775,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,14],"tags":[],"class_list":["post-1795","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-computing-centre","category-news"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Basics of Git version control - Institute of Numerical Modelling<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/modinst.lu.lv\/en\/git-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Basics of Git version control - Institute of Numerical Modelling\" \/>\n<meta property=\"og:description\" content=\"About the author Mg. Phys. Kristaps Bergfelds is a researcher at the Institute of Numerical Modelling (University of Latvia), where his daily duties include acquisition, processing, and plotting of scientific data. Additional to his research, Kristaps teaches programming for physics students (programming and data science basics using Python language). This article is based on Kristaps\u2019 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/modinst.lu.lv\/en\/git-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"Institute of Numerical Modelling\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/modinstlv\" \/>\n<meta property=\"article:published_time\" content=\"2021-02-03T08:53:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-03T13:47:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/0_cover_programming-1030x596.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1030\" \/>\n\t<meta property=\"og:image:height\" content=\"596\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Miha\u0113ls Doro\u0146ins\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Miha\u0113ls Doro\u0146ins\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/\"},\"author\":{\"name\":\"Miha\u0113ls Doro\u0146ins\",\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/#\\\/schema\\\/person\\\/0cc8b45b0663ea4eb91eb0a2e0570d6d\"},\"headline\":\"Basics of Git version control\",\"datePublished\":\"2021-02-03T08:53:43+00:00\",\"dateModified\":\"2021-02-03T13:47:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/\"},\"wordCount\":1821,\"publisher\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/modinst.lu.lv\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/0_cover_programming-scaled.jpg\",\"articleSection\":[\"Computing Centre Tutorials\",\"News\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/\",\"url\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/\",\"name\":\"Basics of Git version control - Institute of Numerical Modelling\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/modinst.lu.lv\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/0_cover_programming-scaled.jpg\",\"datePublished\":\"2021-02-03T08:53:43+00:00\",\"dateModified\":\"2021-02-03T13:47:15+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/#primaryimage\",\"url\":\"https:\\\/\\\/modinst.lu.lv\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/0_cover_programming-scaled.jpg\",\"contentUrl\":\"https:\\\/\\\/modinst.lu.lv\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/0_cover_programming-scaled.jpg\",\"width\":2560,\"height\":1482},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/git-basics\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Basics of Git version control\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/\",\"name\":\"Institute of Numerical Modelling\",\"description\":\"Scientific Institute of the University of Latvia\",\"publisher\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/#organization\",\"name\":\"Institute of Mathematical Modeling\",\"url\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/modinst.lu.lv\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/INM_EN_hor_RGB.jpg\",\"contentUrl\":\"https:\\\/\\\/modinst.lu.lv\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/INM_EN_hor_RGB.jpg\",\"width\":1500,\"height\":540,\"caption\":\"Institute of Mathematical Modeling\"},\"image\":{\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/modinstlv\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/lu-inm\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/#\\\/schema\\\/person\\\/0cc8b45b0663ea4eb91eb0a2e0570d6d\",\"name\":\"Miha\u0113ls Doro\u0146ins\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c7007cd3cf8cad26e93b88168ec847cf158a820316d268247b8547288e036d1?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c7007cd3cf8cad26e93b88168ec847cf158a820316d268247b8547288e036d1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c7007cd3cf8cad26e93b88168ec847cf158a820316d268247b8547288e036d1?s=96&d=mm&r=g\",\"caption\":\"Miha\u0113ls Doro\u0146ins\"},\"url\":\"https:\\\/\\\/modinst.lu.lv\\\/en\\\/author\\\/mihaels-doronins\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Basics of Git version control - Institute of Numerical Modelling","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/modinst.lu.lv\/en\/git-basics\/","og_locale":"en_US","og_type":"article","og_title":"Basics of Git version control - Institute of Numerical Modelling","og_description":"About the author Mg. Phys. Kristaps Bergfelds is a researcher at the Institute of Numerical Modelling (University of Latvia), where his daily duties include acquisition, processing, and plotting of scientific data. Additional to his research, Kristaps teaches programming for physics students (programming and data science basics using Python language). This article is based on Kristaps\u2019 [&hellip;]","og_url":"https:\/\/modinst.lu.lv\/en\/git-basics\/","og_site_name":"Institute of Numerical Modelling","article_publisher":"https:\/\/www.facebook.com\/modinstlv","article_published_time":"2021-02-03T08:53:43+00:00","article_modified_time":"2021-02-03T13:47:15+00:00","og_image":[{"width":1030,"height":596,"url":"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/0_cover_programming-1030x596.jpg","type":"image\/jpeg"}],"author":"Miha\u0113ls Doro\u0146ins","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Miha\u0113ls Doro\u0146ins","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/#article","isPartOf":{"@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/"},"author":{"name":"Miha\u0113ls Doro\u0146ins","@id":"https:\/\/modinst.lu.lv\/en\/#\/schema\/person\/0cc8b45b0663ea4eb91eb0a2e0570d6d"},"headline":"Basics of Git version control","datePublished":"2021-02-03T08:53:43+00:00","dateModified":"2021-02-03T13:47:15+00:00","mainEntityOfPage":{"@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/"},"wordCount":1821,"publisher":{"@id":"https:\/\/modinst.lu.lv\/en\/#organization"},"image":{"@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/0_cover_programming-scaled.jpg","articleSection":["Computing Centre Tutorials","News"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/","url":"https:\/\/modinst.lu.lv\/en\/git-basics\/","name":"Basics of Git version control - Institute of Numerical Modelling","isPartOf":{"@id":"https:\/\/modinst.lu.lv\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/#primaryimage"},"image":{"@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/0_cover_programming-scaled.jpg","datePublished":"2021-02-03T08:53:43+00:00","dateModified":"2021-02-03T13:47:15+00:00","breadcrumb":{"@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/modinst.lu.lv\/en\/git-basics\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/#primaryimage","url":"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/0_cover_programming-scaled.jpg","contentUrl":"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2021\/02\/0_cover_programming-scaled.jpg","width":2560,"height":1482},{"@type":"BreadcrumbList","@id":"https:\/\/modinst.lu.lv\/en\/git-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/modinst.lu.lv\/en\/"},{"@type":"ListItem","position":2,"name":"Basics of Git version control"}]},{"@type":"WebSite","@id":"https:\/\/modinst.lu.lv\/en\/#website","url":"https:\/\/modinst.lu.lv\/en\/","name":"Institute of Numerical Modelling","description":"Scientific Institute of the University of Latvia","publisher":{"@id":"https:\/\/modinst.lu.lv\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/modinst.lu.lv\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/modinst.lu.lv\/en\/#organization","name":"Institute of Mathematical Modeling","url":"https:\/\/modinst.lu.lv\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/modinst.lu.lv\/en\/#\/schema\/logo\/image\/","url":"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2020\/02\/INM_EN_hor_RGB.jpg","contentUrl":"https:\/\/modinst.lu.lv\/wp-content\/uploads\/2020\/02\/INM_EN_hor_RGB.jpg","width":1500,"height":540,"caption":"Institute of Mathematical Modeling"},"image":{"@id":"https:\/\/modinst.lu.lv\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/modinstlv","https:\/\/www.linkedin.com\/company\/lu-inm"]},{"@type":"Person","@id":"https:\/\/modinst.lu.lv\/en\/#\/schema\/person\/0cc8b45b0663ea4eb91eb0a2e0570d6d","name":"Miha\u0113ls Doro\u0146ins","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/6c7007cd3cf8cad26e93b88168ec847cf158a820316d268247b8547288e036d1?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6c7007cd3cf8cad26e93b88168ec847cf158a820316d268247b8547288e036d1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6c7007cd3cf8cad26e93b88168ec847cf158a820316d268247b8547288e036d1?s=96&d=mm&r=g","caption":"Miha\u0113ls Doro\u0146ins"},"url":"https:\/\/modinst.lu.lv\/en\/author\/mihaels-doronins\/"}]}},"_links":{"self":[{"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/posts\/1795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/comments?post=1795"}],"version-history":[{"count":5,"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/posts\/1795\/revisions"}],"predecessor-version":[{"id":1811,"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/posts\/1795\/revisions\/1811"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/media\/1775"}],"wp:attachment":[{"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/media?parent=1795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/categories?post=1795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/modinst.lu.lv\/en\/wp-json\/wp\/v2\/tags?post=1795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}