Git - VSCode User Manual
This article is a basic manual for using Git in VSCode.
This article only demonstrates the Git source code management function provided by VSCode by default, and additional Git plug-ins can be installed for advanced Git functions.
1. Clone the repository
源代码管理
panel, click the克隆仓库
- enter
仓库URL
- Repository URL, example
http://127.0.0.1:8080/username/HelloWorld.git
- Select warehouse storage address
- Open a repository or an item within a repository
源代码管理
In the panel, you can see the status of the Git repository.
For the downloaded project, the branch checked out by default is the main branch.
- View branch status (local branch and remote branch)
2. Create a new feature branch
- Click the branch button, select
从...创建分支
- Choose to create from the remote develop (
origin/develop
) branch
- name the new branch
3. Synchronize the feature branch to the remote warehouse
The new branch (such as: feature_1) is a local branch and needs to be pushed to the remote warehouse on the server.
- Click
发布 Branch
the button to push the local branch to the remote repository.
- View remote warehouse branch status
The new branch should have been added to the remote repository.
4. Add files to version management (add)
- New files (not included in version management yet)
- In
源代码管理
the panel , view files that are not included in version management
- Staging changes
- Temporary After Effects
Files that have been staged, have been added to Git version management (suffix A
: added index)
5. Review code changes
If you want to view the changes of a file, click the file in 源代码管理
the panel , and the comparison result will be displayed on the right.
6. Submit (commit) to the local warehouse
- Fill out the commit
消息
(commit log). - Click
提交
the button .
The submission information must be filled in, otherwise it will not be submitted.
- If you don't write the submission message , you will be reminded to fill it in.
- If you do not write a commit message , the commit operation will be cancelled.
7. Push (push) to the remote warehouse
- Push, click
同步更改
the button
- Check the server to confirm that the push has been successful.
8. Pull updates from the server
- The remote warehouse has been modified and needs to be updated to the local warehouse
- Click
同步
the button to pull updates from the remote warehouse
- The synchronization results are as follows. A new file Department.json has been added locally.