Sublime Merge - a super easy-to-use Git visualization tool

Written first: It is best to configure password-free login for git before using this tool. For the method, please refer to the link below.

Git generates ssh-key to enable password-free login to github

1. Installation tools
You can download the installation package from Baidu yourself, or download the installation package provided at the end of this article.

There is nothing to say about the installation steps, just "next step - next step". I won’t go into details here.

 
2. Open Tools-Open Project
and click this:

File-New Repository. Find our local git project that has been pulled down.

 

Then you can see our current project here:

Illustration notes:
1: Project directory, used to display the currently opened Repository.

2: Localtions, all local branches.

3: Commits, all submission records.

4: Files, there are currently modified files.

5: Summary, all file directories in which the latest content locally and on git are inconsistent.

6: Pull, pull the project.

7: Push, submit the project.

8: Stash, submit the current modifications to the local area (sometimes you can temporarily save the local modifications to the local warehouse for insurance purposes).

9: Pop Stash, release local warehouse modifications.

10: It can be understood as a browser. You can see all branches here. After clicking on it, you can switch branches with one click.

3. Daily operations (pull/submit/merge)
 

Recommended action:

1. Submit (push): When submitting (push) local modifications, it is recommended to pull (pull) the latest code. At this time, if you are afraid that the local modifications will be conflicted, it is recommended to click on the above mentioned 2-8: Stash first. button to save local modifications to the local warehouse first.

After the code merge is completed, right-click on 2-3: Commits to select the current submission content, click Apply Stash, and submit the content in the local warehouse to git.

As shown in FIG:

Stage: It is somewhat similar to commit in svn. This commit is equivalent to submitting changes to the local warehouse. Click the Stage on the right side of the file that needs to be modified. Then Nothing to commit will change to commit X files as shown in the above figure. At this time, clicking commit Submit the content to git.

Discard: somewhat similar to revert in svn, restoring local modifications.

In case of conflict, refer to 4

Summarize:

1 Click stage-2 at the target file, click Commit 1 file-3, click push to submit to git

2. Pull: There is usually no conflict when pulling code.

Possible pull failure: There are local modifications that are inconsistent with the latest ones on git. In this case, you need to submit the local modifications first;

3. Merge code (merge from branch A to branch B): Update branch B to the latest without conflicts - switch to branch A and update to the latest - switch to branch B, click the buttons at the three dots on the right side of 2-10, in On the pop-up page, click Merge Branch..., then click on branch A in the pop-up page, and then click Merge in the new pop-up menu. Usually, if there are no conflicts or errors at this step, and you are just merging branches, click directly. Commit here, then click 2-7, push up to complete the operation of merging the code.

4. Conflict resolution: When there are conflicts, be careful not to submit them randomly. It is recommended to carefully review the conflicts, determine which ones can be resolved by oneself and which ones need to be confirmed with colleagues, and then take action. If you are sure, you can view the conflict files one by one on the right side of 2-5Summary. It is recommended to right-click the conflicting code, click open in editor, then operate the code, and then click commit to submit the conflicting file. If you do not need to compare the code, such as directly discarding the current modification or discarding the latest modification on git, you can directly click the three-dot button behind the conflict file and select our (overwrite the one on git with local files), or select theirs ( Use the latest one on git to directly overwrite the local one).

4. Other
restore historical versions: directly find the corresponding file in the 2-3 Commits history record, then click the three dots on the right side of the file, and click Revert File on the pop-up page to restore this version of the code to the local. You can refer to the above later. commit operation.

 
——————————————
Copyright Statement: This article is an original article by CSDN blogger “National First-Class Fishing Player” and follows the CC 4.0 BY-SA copyright agreement. Please attach the original text when reprinting Links to sources and this statement.
Original link: https://blog.csdn.net/qq302756113/article/details/112394807

Guess you like

Origin blog.csdn.net/modi000/article/details/132548424