Use Git through the version control tool VCS in Pycharm

In daily development, how to use git to do a good job of version management is a very important topic. In addition to using the command line in Git Bash to manage code, we also have a more concise tool that does not use the command line to manage code and track changes. It is to use VCS directly in the IDE. For Python development students, this IDE is usually Pycharm.

  1. clone project

insert image description here

Enter the project address in the pop-up dialog box, and select the local storage location to complete the clone.

If you want to create a new project, there are two ways:

1. You can directly select VCS -> Import into Version Control -> Create Git Repository in VCS to create, so that you only need to add the warehouse address when submitting for the first time.

2. Create a new project directly through new project in git, then clone to the local, and then develop and submit the code.

If you have already cloned or created a project locally, you need to pull the latest project code and update it based on the latest code. You can use the fetch or pull command.

insert image description here

Fetch is to obtain the latest version from the remote to the local, and it will not automatically merge. It needs to be manually compared/modified to decide whether to merge. You can compare with branch.

insert image description here

git pull is to directly pull the latest version and perform a merge, which is usually more convenient to use.

  1. git add

insert image description here

After the project changes, directly add can submit the changes to the temporary storage area.

  1. git commit

insert image description here

Before committing, you can use the dialog box below to compare the current project code to see what changes have been made.

  1. git push

insert image description here

After the commit, you can perform the push operation, and then view the results

insert image description here

You can see that the code has been updated.

In fact, in the commit step, you can also directly choose commit and push to complete the two operations of commit and push at one time.

  1. new branch

There are two ways to create a new branch in VCS, the first is through the menu bar

insert image description here

The second is directly through the branch selection in the lower right corner

insert image description here

Through the small window in the lower right corner, you can directly switch to the branch you want to develop. After the development is completed, submit the modification to your own branch through push.

If you need to merge the modification of the new branch, it means to accept this modification to the main branch, switch to the master branch through the small window, and select merge changes

insert image description here

You will be prompted which partition you want to select for merging.

  1. View all update history of the project

insert image description here

You can view all the actions made by the project members~

There are still many possible situations that need to be explored slowly in actual development, so, enjoy~

• END •

Manuscript | Full Stack Architect

Editor | Full Stack Architect

insert image description here

Note: For more architectural knowledge, click the original link to view.

Search for "topology software" on the official account to see more.

Guess you like

Origin blog.csdn.net/weixin_39750084/article/details/115512611