Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Warehouse Management of Git. Md example Analysis

Shulou Source: shulou.com Published: 2022-06-02 12:58:01 10月03日 Update

This article mainly introduces the warehouse management of Git. Md example analysis, the article is very detailed, has a certain reference value, interested friends must read it!

Today, let's talk about the warehouse management of Git from two aspects. Set up the warehouse and track the changes in the files in the warehouse.

Get Git warehouse

There are two ways to get the git repository:

Use the local uninitialized directory as the warehouse directory

Clone an existing Git project from a remote host

Here is a demonstration of these two methods:

# mkdir learngit# cd learngit/# git initInitialized empty Git repository in / root/learngit/.git

In this way, a local warehouse has been built. Let's take a look at how to clone the repository from a remote location.

# mkdir learngit2# cd learngit2# git clone git@github.com:*/blog.git learngit2

This directive means to clone the Git repository remotely and change the directory to learngit2. If this parameter is not available by default, the directory name is blog.

Track every update to the warehouse

First of all, you need to talk about the status of the file. in a large sense, there are two states of the file:

Untracked (Untracked)

Tracked

The tracked status is divided into unmodified, modified, and temporarily saved. An untracked file indicates that the version library is not tracking the file.

Next, let's demonstrate the status of these files.

First, create a new file in the project directory

# touch README.md

Then, let's look at the status of the file. Git status can list the status of the file, if you do not add the file, it means to list all.

# git status README.md # On branch master## Initial commit## Untracked files:# (use "git add..." To include in what will be committed) # # README.mdnothing added to commit but untracked files present (use "git add" to track)

As you can see, the README.md status is untracked. Now, let's create another file, add it to the staging area, and then look at the status of the file.

# cat > index.php

Tags: File warehouse status store track update directory content method example analysis management information workspace situation file name aspect time article editor Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Docker NVidia Huawei Apple