Most complete Pycharm tutorial (--pycharm) Local git usage for version control

Source: Internet
Author: User

1. Theme

Describes if you use a local git set through Pycharm.

2. Preparatory work

(1) Pycharm version 2.7 or higher

(2) A project has been created

(3) Git plugin is available, corresponding executable file is configured correctly on Git page page

3. Create a Git set

Press ALT + ' show commonly used VCS commands (also available via the main menu Vcs→vcs Operations Popup), select the Create Git repository command:

Git installs the local repository by creating a. Git folder under the parent directory. Here we choose to create a. git directory under the root directory:

4, Pycharm user interface changes

(1) Changes tool window appears

(2)solver.py file name discoloration

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

(3) Open the Settings dialog (ctrl+alt+s), click Version Control and discover that the Mysimplepythonapplication directory is already associated with git:

5. Add version control to files

Method put a file under version control, here is an example. Select the solver.py file and press Ctrl+alt+a.

The solver.py file turns green, which means that version control is already in place but not yet managed:

6. Submit the Local repository

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

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

7. View Current Branch

Two different ways:

First, use the main menu command vcs→git→branches, in the popup window to view:

Second, use the Git component on the status bar:

8. Change the main branch code

Take rename as an example. Position the cursor on the DISCR symbol and press SHIFT+F6 to enter the new name discriminant.

Note that at this point the left slot produces the corresponding tag:

Click this flag and Pycharm will pop up to prompt for the current changes. Press the Ctrl+k shortcut key to update the code.

9. Create a new branch

Click the Branch icon on the status bar and enter a name:

The new branch is now in the Current Changes Tool window window as a tab:

Next, create a second branch (BRANCH2) from the main branch.

10. Change the code in the new branch

Switch to branch 1:

Position the cursor on the discriminant symbol, press SHIFT+F6, enter shorthand, such as dis, and then press Ctrl+k to host the change.

Do the same for branch 2.

11. Merging branches

You can only merge the current branch onto another branch. Use the Vcs→git→merge changes main menu command:

Choose to accept these changes and host them again, and find them more complex than before:

  

Full Pycharm Tutorial (--pycharm) version-controlled local git usage

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.