Files
learning-way/Git/Repository.md
2025-06-27 22:24:46 +08:00

30 lines
937 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 仓库(版本库)
版本库又名仓库Repository可以**简单理解成一个目录**这个目录里面的所有文件都可以被Git管理起来每个文件的修改、删除Git都能跟踪以便任何时刻都可以追踪历史或者在将来某个时刻可以“还原”。
### 新建仓库
Git将会将创建一个新目录并初始化为Git仓库新建一个隐藏的`.git`文件夹,里面包含了此仓库的所有配置文件。
```shell
git init <Repository Name>
```
> 一定不要动`.git`文件夹里的东西!
### 初始化当前目录
```shell
git init
```
Git将会将此目录初始化为Git仓库新建一个隐藏的`.git`文件夹,里面包含了此仓库的所有配置文件。
> 要保证目录为空,不然会报错
### 添加所有文件至暂存区
```shell
git add .
```
### 提交
```shell
git commit -m "提交提示"
```
### 上传项目
```shell
git push
```