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