Git serialization (1) Download and install Git and TortoiseGit

 

Software Configuration Management (SCM) with Git

        SVN is a widely used version control system, but the main weakness of SVN is that it must be connected to the server at all times, and once the network is disconnected, SVN will not work properly.

        Since Linus (the founder of the Linux system) was very unfamiliar with SVN (because SVN must be connected to the Internet to use it), Linus started to develop a new distributed version control system in 2005: Git. Soon, many people felt the charm of Git and switched to Git.

        In 2008, the GitHub website was launched, which provided free Git storage for open source projects, and countless open source projects began to migrate to GitHub, including jQuery, MyBatis, and more.

        Compared with Git, the essential difference between SVN and Git is that SVN is a centralized version control system, while Git is a distributed version control system.

        Let’s briefly review the centralized version control system (take SVN as an example). The version library of SVN is stored in the central server. When each developer needs to work, he must first synchronize the latest code from the central server (download the latest code) version), then start the modification, and submit it to the server after the modification.

        Let's introduce the distributed version control system (taking Git as an example). For Git, each developer's local disk stores a complete version library, so developers do not need to connect to the Internet when working, and developers can directly use A local repository will do. Management through a "central server" is only necessary when multiple people are required to collaborate with each other.

        Tip: Simply put: Compared with SVN, Git's changes are equivalent to allowing each developer to "cache" a complete repository locally, so developers add, delete, and return to the project files they develop. In previous versions, it did not need to be done through the server.

Download and install Git and TortoiseGit

        Git is developed by Linus, so Git naturally runs on the Linux platform at first. Later, Git also provided corresponding versions for Windows, Mac OS X and other platforms. This book uses Windows 7 as an example to introduce the installation and use of Git.

        To download and install Git, please follow the steps below.

        (1) Log in to the Git official website download site https://git-scm.com/download/win, and download the latest version of Git. When this book was written, the latest stable version of Git was 2.15.0.

        (2) Download Git 2.15.0, and get a Git-2.15.0-64-bit.exe file after the download is complete (this is the 64-bit installation file, if the reader uses a 32-bit operating system, please download the 32-bit installation file ).

        (3) Double-click the Git-2.15.0-64-bit.exe file to start the installation. The first thing you see is the protocol that Git complies with (GNU protocol), click the "Next" button directly, and the next dialog box will be displayed. Ask the user in which directory to install Git (usually it is recommended to install it directly in the root directory), and then you can see the dialog box for selecting installation components as shown in Figure 1.60.

Figure 1.60 Select installation components

        (4) In the "Select Components" dialog box, uncheck the "Windows Explorer Integration" checkbox - this is because we are not going to use Git itself to provide GUI tools, but rather TortoiseGit. Click the "Next" button again.

        (5) The installer asks if you need to create a menu for Git in the Windows start menu, usually without modification, just click "Next", the installer displays the dialog box shown in Figure 1.61, which asks whether you need the PATH environment variable .

Figure 1.61 Whether to modify the PATH environment variable

        (6) For convenience, the git command needs to be added to the Windows command line window; for security reasons, it is not necessary to add Unix tools to the Windows command line window, so select the second command in the dialog box shown in Figure 1.61. Click the "Next" button after selecting the box. The installer displays the dialog shown in Figure 1.62, which asks which SSH tool to choose.

Figure 1.62 Choose which SSH tool

        (7) If TortoiseSVN is installed on the machine, Git will ask whether to use the default OpenSSH tool? Or use the Plink tool provided by TortoiseSVN? There is no need to adjust here, so directly select the default OpenSSH tool, click the "Next" button again, the installer asks the user to select the transport protocol for the HTTPS connection, select the default OpenSSL library and click the "Next" button, the installer displays as follows The dialog shown in Figure 1.63, which asks how to handle newlines in a file.

Figure 1.63 Asking how to handle newlines

        (8) As can be seen from Figure 1.63, the first conversion option will convert newlines to Windows newlines when downloading files; and convert newlines to Unix newlines when submitting files - this is the most suitable for Windows developers. method, so select the first radio box here; the second option is suitable for Linux and Unix developers; the third option does not do any conversion, so it is not suitable for cross-platform projects. After selecting the first radio box, click the "Next" button, the installer asks which "terminal emulator" to use, keep the default and click the Next button, in the next dialog box, click the "Install" button to install Git.

        After the installation is complete, readers can use the git command in the Windows command line window. Enter git in the command line window and press Enter, you can see the following prompt information:

C:\Users\yeeku>git
usage: git [--version] [--help] [-C <path>] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

These are common Git commands used in various situations:
...

        The above prompt message indicates that the Git installation was successful.

        If users like command line tools very much, they can use git commands directly in the command line window for software configuration management. However, for most readers, using git commands directly is more laborious, so this book will also introduce a very useful tool: TortoiseGit.

        Downloading and installing TortoiseGit is very simple, just follow the steps below.

        (1) Log in to the TortoiseGit official download site https://tortoisegit.org/download/ and download the latest version of TortoiseGit. When this book was written, the latest stable version of TortoiseGit was 2.5.0.

        (2) Download TortoiseGit 2.5.0, and get a TortoiseGit-2.5.0.0-64bit.msi file after the download is complete (this is the 64-bit installation file, if the reader uses a 32-bit operating system, please download the 32-bit installation file), Double-click the file to start the installation. Installing TortoiseGit is not much different from installing ordinary software.

        TortoiseGit has been integrated into Windows Explorer, so using TortoiseGit is very simple. Right-click any file, folder, or blank space in Windows Explorer to see the corresponding TortoiseGit in the pop-up shortcut menu. menu. Figure 1.64 shows the TortoiseGit tools menu that appears when you right-click the mouse.

Figure 1.64 TortoiseGit tool menu integrated in the right-click menu

        Tip: TortoiseGit also provides a language pack, which can translate the software into a simple Chinese interface, but considering the working environment of software development (most people use English, or even collaborate with foreign developers), it is recommended to keep the English interface .

This article is adapted from the Crazy Java Forum: http://www.crazyit.org/forum.php

Spring Cloud teaching video: https://my.oschina.net/JavaLaw/blog/1552993

JD.com purchase address: https://item.jd.com/12256011.html

Workflow Activiti teaching video: https://my.oschina.net/JavaLaw/blog/1577577

Activiti6 purchase address: https://item.jd.com/12246565.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324390728&siteId=291194637
Recommended