Home >Development Tools >git >How to add a directory in git

How to add a directory in git

WBOY
WBOYOriginal
2022-01-14 15:04:429820browse

In git, you can use the add command to add a directory. The function of this command is to add the specified file or directory to the temporary storage area. The syntax is "git add folder/"; after adding the directory, you can use "git status" command to view the addition results.

How to add a directory in git

The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.

How to add a directory in git

git add folder/           Add the entire folder and its contents

git add *.file Type Add all files of this file type in the directory

The git add command can add the file to the staging area.

Add one or more files to the staging area:

git add [file1] [file2] ...

Add the specified directory to the staging area, including subdirectories:

git add [dir]

Add all files in the current directory To the staging area:

git add .

In the following example, we add two files:

How to add a directory in git

The git status command is used to view the current status of the project.

Next we execute the git add command to add files:

$ git add README hello.php

Now we execute git status again, and we can see that these two files have been added.

How to add a directory in git

Recommended study: "Git Tutorial"

The above is the detailed content of How to add a directory in 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