Git - VSCode User Manual

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克隆仓库

insert image description here

  • enter仓库URL

insert image description here

  • Repository URL, example
http://127.0.0.1:8080/username/HelloWorld.git
  • Select warehouse storage address

insert image description here

  • Open a repository or an item within a repository

insert image description here

  • 源代码管理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.

insert image description here

  • View branch status (local branch and remote branch)

insert image description here

2. Create a new feature branch

  • Click the branch button, select从...创建分支

insert image description here

  • Choose to create from the remote develop ( origin/develop) branch

insert image description here

  • name the new branch

insert image description here

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 发布 Branchthe button to push the local branch to the remote repository.

insert image description here

  • View remote warehouse branch status

The new branch should have been added to the remote repository.
insert image description here

4. Add files to version management (add)

  • New files (not included in version management yet)

insert image description here

  • In 源代码管理the panel , view files that are not included in version management

insert image description here

  • Staging changes

insert image description here

  • Temporary After Effects

Files that have been staged, have been added to Git version management (suffix A: added index)

insert image description here

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.

insert image description here

6. Submit (commit) to the local warehouse

  1. Fill out the commit 消息(commit log).
  2. Click 提交the button .

insert image description here

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.

insert image description here

  • If you do not write a commit message , the commit operation will be cancelled.

insert image description here

7. Push (push) to the remote warehouse

  • Push, click 同步更改the button

insert image description here

  • Check the server to confirm that the push has been successful.

insert image description here

8. Pull updates from the server

  • The remote warehouse has been modified and needs to be updated to the local warehouse

insert image description here

  • Click 同步the button to pull updates from the remote warehouse

insert image description here

  • The synchronization results are as follows. A new file Department.json has been added locally.

insert image description here

Guess you like

Origin blog.csdn.net/sgx1825192/article/details/129175947