Article Directory
1. Create a git repository
Syntax: git init name
Parameter description:
- name: refers to the name of the warehouse, that is, the name of the project. A project corresponds to a warehouse.
Example:
The following command creates a blog
warehouse named .
git init blog
2. Bring the code into version control
git add command: write the contents of the snapshot into the buffer.
Syntax: git add fileName
Parameter description:
- fileName: Specify which files are to be included in version control. Wildcard matching can also be used. For example, to use it
git add .
is to include all the files in this blog warehouse into version control.
Example:
Bring all files in the warehouse into version control
git add .
Put all .c
files ending in the warehouse into version control
git add *.c
3. Add code to the warehouse (local warehouse)
git commit command: Add the contents of the cache area to the warehouse (local warehouse).
Syntax: git commit -m
Parameter description:
- -m: The comment submitted, that is, the description of this submission.
example:
git commit -m "修复项目中日志模块添加日志的一处bug"
4. Push the code to the GitHub remote warehouse
grammar:
git push -u origin master
git remote add origin git@github.com:GitHub的账户名/仓库名.git
example:
git remote add origin git@github.com:QingFeng-lx/blog.git
5. Clone the warehouse
Syntax: git clone [url]
Example:
git clone https://github.com/QingFeng-lx/blog.git