Home  >  Article  >  Development Tools  >  How to create a local repository with git

How to create a local repository with git

藏色散人
藏色散人Original
2018-11-16 15:23:1812007browse

This article mainly introduces Git to create a local version library.

GIT, is a distributed version control system that can handle our large and small projects efficiently and quickly, and version library, also known as warehouse, you can simply Understood as a directory, all files in this directory can be managed by Git. Git can track the modification and deletion of each file, so that the history can be tracked at any time, or it can be "restored" at some point in the future.

Git is also a tool commonly used by programmers. So in the previous article, I have given you a detailed introduction to What is Git and The initial use of Git.

The following will continue to explain to you the steps of Git to create a local repository.

Step 1: Select a suitable file directory, right-click the mouse to open the Git command line,

How to create a local repository with git

Step 2: Use the mkdir command to select the specified location to create an empty directory (local version library). Here we created the test directory through the "mkdir test" command. Then cd to the newly created test directory.

Step 3: Use the git init command to turn this newly created directory into a warehouse that Git can manage, and it is an empty warehouse (empty Git repository) , the directory named .git here is used by Git to track and manage the repository. Note: The .git folder should be deleted carefully, otherwise the repository data will be lost.

The specific operation is as follows:

How to create a local repository with git

The fourth step, open the test folder locally, you may find that there is no .git Directory, this is because the .git directory is hidden by default.

At this time, we need to manually set some options, as shown below, find the tool under test and click on the folder option.

How to create a local repository with git

Select View, check Show hidden files and folders, and then confirm the option.

How to create a local repository with git

#Finally, we can find the .git directory by refreshing the test directory.

How to create a local repository with git

At this point, the new version library is created!

This article is an introduction to the specific methods and steps of Git to create a repository. It is very easy to understand. I hope it will be helpful to friends in need!

The above is the detailed content of How to create a local repository with git. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn