Git serialization (2) Create a local repository

Git creates a local repository

        Creating a local repository is easy: select the working directory that requires version management, and then create a repository under that working directory. The specific implementation can be performed according to the following steps.

        (1) Select the working directory that requires version management. For example, the G:\gitJava directory is intended to be versioned. Enter the directory through the resource manager, right-click on the blank space, TortoiseGit pops up the menu shown in Figure 1.64, and click the "Git Create repository here..." menu item of the menu. The system pops up a dialog box as shown in Figure 1.65.

Figure 1.65 Creating a Repository

        (2) There is a "Make it Bare" check box in this dialog box. If the check box is checked, it means that the directory is initialized as a "pure version library" (developers cannot work in this directory ), so leave the checkbox unchecked here. Click the "OK" button to successfully create the local repository.

        Tip: The above steps are equivalent to executing the git init command in the G:\gitJava directory, which is also used to create a local repository in the specified directory. Executing the git init --bare command is equivalent to checking the "Make it Bare" checkbox in the dialog box shown in Figure 1.65.

        After the creation is completed, Git will create a new hidden .git folder in the G:\gitJava directory. This folder is the local repository of Git, which is responsible for managing the addition, deletion, modification, and modification of files in the G:\gitJava directory. branch, etc.

        After you create a local repository, you can perform some preliminary configuration of the repository.

        Right-click on the blank space of the repository directory (G:\gitJava), the system will pop up the menu shown in Figure 1.64, click the "TortoiseGit" → "Settings" menu item in the menu, the system will pop up as shown in Figure 1.66 settings interface.

Figure 1.66 TortoiseGit parameter setting interface

        The settings interface shown in Figure 1.66 provides common settings categories:

  • General category: The setting interface of this category is mainly used to set general information such as interface language, font, font size, font color, etc.
  • Git category: The setting interface of this category is mainly used for related information about Git itself.
  • Diff Viewer: This category is used to set the comparison interface of the Diff file comparer.
  • TortoiseGitUDiff: This category is used to set the comparison interface of the TortoiseGitUDiff file comparator.

        The Git-related settings are mainly introduced here, so click the "Git" node on the left side of the dialog box shown in Figure 1.66, and select the Global radio button at the top of the editing interface to see the dialog box shown in Figure 1.67.

Figure 1.67 Setting global user information for Git

        Enter the Name, Email, and Signing key information in the dialog box shown in Figure 1.67. These information will be used as the identifier for the user to submit the code (that is, to tell Git who is submitting the code). You will see later: every time we submit the code, Git will Record this user information.

        The global information of Git is set through the dialog box shown in 1.67. The global information is saved in plaintext in the .git-credentials file under the user's HOME directory (the Windows user's HOME directory is C:\Users\<username>). Users can also edit the .git-credentials file directly via the "Edit global .gitconfig" button at the bottom of the dialog shown in Figure 1.67, which is more straightforward - but prone to errors for novice users.

        Click the "Local" option at the top of the dialog box shown in Figure 1.67, indicating that Git-related information is set for the current project. At this time, you can reset the Name, Email, Signing key and other information. Local information is saved in plaintext in the config file in the .git directory. Developers can also edit the config file directly through the "Edit local .git/config" button at the bottom of the dialog shown in Figure 1.67. This method is more direct - but for For novice users, it is easy to make mistakes.

        When the local information and the global information are inconsistent, the local information wins. If the user information entered under the Global option and the Local option are inconsistent, click the "Effective" option (this option is used to display the actual effective user information) to see that the actual effective user information is entered under the Local option.

 

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=324391190&siteId=291194637