Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Warehouse Management of Git. Md example Analysis

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report