The most complete Pycharm tutorial (39) -- local Git usage of Pycharm Version Control

Source: Internet
Author: User

The most complete Pycharm tutorial (39) -- local Git usage of Pycharm Version Control

1. Subject

This section describes how to use a local Git set through Pycharm.

2. Preparations

(1) The PyCharm version is 2.7 or higher.

(2) You have created a project.

(3) The Git plug-in is available. The corresponding executable file is correctly configured on the Git page.

3. Create a Git set

Press Alt + 'to display common VCS commands (you can also choose VCS> VCS Operations Popup on the main menu) and select the Create Git repository command:

Git creates a. git folder under the parent directory to install the local version library. Here we choose to create the. git directory under the root directory:

4. Pycharm user interface changes

(1) The Changes tool window appears.

(2) Changing the file name of Solver. py

This also means that version control has not been added to the new file (will be introduced later ).

(3) Open the Setting Dialog Box (Ctrl + Alt + S), click Version Control, and find that the MySimplePythonApplication directory has been associated with Git:

5. Add Version Control for files

Method put a file under version control. Here is an example. Select the Solver. py file and press Ctrl + Alt +.

The Solver. py file turns green, meaning version control has been performed, but it is not hosted yet:

6. Submit the local version Library

In the Changes tool window, select the Solver. py file, press Ctrl + K, enter information, and click Commit.

Open the Log tab of Changes tool window to view details;

7. view the current Branch

Two methods:

First, run the main menu command VCS → Git → Branches. In the displayed window, View:

Second, use the Git component on the status bar:

8. Change the main branch code

Take renaming as an example. Position the cursor on the discr symbol, press Shift + F6, and enter the new name discriminant.

Note that the Left slot will generate the corresponding Tag:

Click this flag, and the Pycharm pop-up window prompts the current changes. Press Ctrl + K to update the code.

9. Create a new branch

Click the branch icon on the status bar and enter the name:

The new branch is now in the current Changes tool window as a tab:

Next, create the second branch (Branch2) from the master branch ).

10. Change the code in the new branch

Switch to branch 1:

Position the cursor on the discriminant symbol, press Shift + F6, enter the abbreviation, such as dis, and then press Ctrl + K to host the changes.

Perform the same operation on Branch 2.

11. merge branches

Only the current branch can be merged to another branch. Use the main menu command of VCS → Git → Merge Changes:

Choose to accept and host these changes and view them again. It is more complicated than before:

  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.