1. What is Sourcetree?
- Project version control software with visual interface for GIT project management
- Windows, Mac available
2. Get the Project code
1. Click clone/New
2. Enter the project address in the popup box, either HTTP or SSH address
If the arrow points to a warehouse type that says "This is not a standard git repository", there may be the following reasons
1) Project address get error
2) No Project access rights
3. Click "Clone", wait for the project clone to complete, after completion, left only one branch master
After cloning is completed, the release of the master source code, if you want to get the latest in the development of the source code, you need to initialize the project flow, click "Git Workflow"
Direct point "OK", get develop branch source code
The development tasks are done on the develop branch.
4. There are 5 types of branches
1) Master, the final release version, the entire project has only one
2) Develop, the development branch of the project, in principle the project has only one
3) feature, function branch, used to develop a new function
4) Release, pre-release version, a version between develop and master, primarily for testing
5) Hotfix, fix patch, fix bug on master, directly acting on master
5. As described earlier in master and develop, when a new feature needs to be added to the development, new feature branches can be created to add new functionality without affecting the develop source code in development, and when new features are added, the feature branch is completed. Merging new features into develop, updating code on develop
1) new feature. First, the current development branch points to develop, click "Git Workflow"
Select "Create a new branch"
As you can see in the preview, the feature branch is separated from the develop, enter the function name, click OK, add the feature branch to the project structure, and the current development Branch points to the new feature branch
2) Develop tasks under the F_add_feature branch and submit
The above operations to increase the feature_1, feature_2, feature_3 files, submitted 3 times, the project folder under a total of three files
When switching to develop branch, it will be found that there is no new three files under the develop, indicating that the operation under feature does not affect the develop branch source code
3) After completing the feature development, merge the source code in the feature into the develop branch. Point the current branch to the F_add_feature branch, click on "Git Workflow" and select "Finish function"
Preview, indicating that the feature branch will be merged into develop, click OK, commit the merge, merge successfully
4) If you need to add new functions, repeat the above actions.
5) When multi-person collaboration development, may appear, different people to the same file operation, resulting in merge conflicts, this situation is simulated, in the current new two feature, respectively, the Feature_1 file is modified, and then merged separately
Feature_1 do the following under Feature_1.txt
Feature_2 do the following under Feature_1.txt
Merge F_feature_1 and f_feature_2, there will be conflicts
Click Close to view uncommitted changes, prompting feature_1.txt for a conflict,
Open Feature_1.txt
The code that appears between <<<<<<< HEAD, =======, >>>>>>> feature/f_feature_2,head, and = numbers represents the current branch , between the = sign and >>>>>>> feature/f_feature_2 the code under the branch to be merged,>>>>>>> Feature/f_ Feature_2 represents the branch name of the branch to be merged.
Depending on the situation, distinguish the code that you want to keep, the code you want to delete, and then delete <<<<<<< HEAD, =======, and >>>>>>> feature/f_ Feature_2
To commit the modified code again
Once a feature merge conflict occurs, the feature branch to be merged will not be deleted, such as f_feature_2, to ensure that the merge is not a problem and can be deleted manually f_feature_2
6. When developing to a certain stage, you can release the beta version, from the develop branch, set up the release branch, into the pre-release testing phase. Click on "Git Workflow" and select "Create a new release"
As can be seen in the preview, release is separated from develop, enter the release version name ' r_v1.0 ', click OK
r_v1.0 as a phased release version, mainly used for testing before release, follow-up development work is still on the develop, if the test process to find problems, directly on the release to modify, after the completion of the submission
7. After two modifications to the release branch r_v1.0, the test is complete, it can be released formally, under the current branch point to r_v1.0 branch, click "Git Workflow", select "Complete release version"
As you can see in the preview, r_v1.0 to develop and master respectively, click OK to complete the release.
When the merge is complete, the default point to develop is the current branch, master adds multiple version updates, pushes the master branch to Origin, completes the online publishing
8. After the release of the official version, develop can continue to develop, when the official version of the problem, you need to make changes to the problem, you can set up the master branch to modify the patch hotfix. Switch the current branch to master, click on "Git Workflow" and select "Create a new fix"
The hotfix branch in the preview is pulled out from master, enter the fix name, click OK
Under this branch to make the master problem modification, after the completion of the modification to commit. When all the patch issues have been modified, click on "Git Workflow" and select "Fix Patch"
In the preview, h_fix_1 to master and develop respectively, click OK to complete the branch merge.
After the merge is complete, the default current branch for the Develop,master branch has a version that needs to be updated, the current branch is switched to master, the push is done, and the patch is repaired.
9. When the release version is complete and the fix is complete, if you encounter a conflict, you can follow the above 5 to make a conflict modification, and then do the following
Basic use of Sourcetree