当前位置:网站首页>Sourcetree usage
Sourcetree usage
2022-06-30 04:53:00 【LintonL】
One 、SourceTree brief introduction
SourceTree yes Windows and Mac OS X Free of charge Git and Hg client , Have a visual interface , Easy to operate . And it's also Mercurial and Subversion Version control system tools . Support the creation of 、 Submit 、clone、push、pull and merge Wait for the operation .
Two 、 Download and install SourceTree step
1、 Download address :https://www.sourcetreeapp.com/, This version is in Chinese
After downloading, you can install .
2、 install SourceTree
Installation first interface
Click on ,Next
Click on “install”, After installation , open sourcetree, Click on “user an existing account”, Pictured
Be careful :1 Just log in with your Google account , The premise is that you must be able to go to Google .
GOOGLE After account login , Pictured :
No need to set here , Just click “ Skip initial setup ” that will do .
After successful login and registration , Pop up settings puttykey The interface of , Click on “ Cancel ” that will do .
Click on “ Cancel ” Button , Pop up the following prompt box :
At this point, enter sourcetree Main interface , You can use it now sourcetree La .
3、 ... and 、 Integration file comparison plug-in
Install the comparison plug-in
Sourcetree In the integration Beyond Compare 4, When the file conflicts, the conflict can be well resolved . The installation process is simple , No more details here .
Sourcetree Middle configuration Beyond Compare 4
menu bar ,“ Tools ”——“ Options ”, As shown in the figure :
choice “ Compare ” tab , Then change the content in the red box to as shown in the figure :
Four 、SourceTree Basic use
clone
Click the clone button , Cloning project :
It can be local git project , It can also be an item in a remote directory ,
Locally existing git project ,
Get project clone address , Click the clone button , As shown in the figure :
1、 The path to the clone project
2、 Where the clone item is stored
3、 If you want to download a specific branch , You can download by Branch
Configuration ignore file
utilize .gitignore Filter files , Such as intermediate files in the compilation process , wait , These documents do not need to be tracked and managed .
.gitignore Files only work for files that have not yet been versioned , If it has been used before git These files are included in the version library , It doesn't work
Use sourcetree Add methods to ignore files :
Under normal circumstances , After creating the project, the administrator needs to directly create the ignored file . The creation method is shown in the figure :
Follow the above steps to edit the conflict file .
Conflicting file rules :
Ignore folders ( Such as :bin、obj):
obj/
bin/
All under a directory .txt file ,
obj/*.txt
During the development process, you may encounter some files that are not added in the ignored files , At this time, the developer needs to add and ignore files by himself , Add as follows :
Files that are not under version control or are under version control have been introduced before , stay sourcetree Of “ File status ” Find... In the tag , As shown in the figure :
Right click the file you want to ignore , Click on “ Ignore ”, Select the mode to ignore , You can ignore the file , As shown in the figure :
tag Usage method
hit tag The purpose of is to have a tag at the main node of the code , The next time you modify the code, you can accurately find the code you want to find . Instead of looking at the log file to recall the location of the code you are looking for .
Branch management and use
Use sourcetree It's convenient to create and use branches , It's not like before TortoiseGit Branches can only be created at the current code , Use sourcetree The convenience of :
1、 You can select a specific version to create a branch
2、 When checking out code, you can check out by branch
3、 The addition of branches is simple
Branch add :
1、 You can create branches in the current version
2、 Select the specified commit to create a branch
3、 Click on “ Create a branch ”
The branch is submitted to the server :
stay sourcetree In the branch list in the content on the right , Select the branch created , Right click to submit , As shown in the figure :
Branch merging :
1、 The branch merge function is similar to the branch add function , No more details here , Note that you should first switch to the merged branch , Then perform the merge operation .
2、 When branches merge , You can select a specific submission for consolidation , At the same time, the main branch can be merged into the sub branch ; Child branches can be merged into the main branch ; You can also merge between child branches .
GIT And SVN Sync
git svn Toolset has to be used at present Subversion The server or development environment requires Subversion Server is especially useful . Think of it as a lame Git, This is not recommended in practical use GIT.
Basic steps
Submit 、 Pull and push
Submit :
Project submission is to maintain the local version library , If there are uncommitted content in the local area , Pull and push are not allowed ; When there is content in the area shown in the figure , Then it represents the content not submitted locally :
Click on Stage All, Filling in the submission information can be used to transfer the local content ( Temporary storage area ) Submit to local repository , As shown in the figure :
1、 Staging files that are not staged , If some files do not need to be temporarily stored , You can delete , Select Chinese file , Right click “ remove ” that will do .
Pull : Update code remotely , amount to SVN Of “ to update ”
push : Submit code to remote .
Resolve conflicts
Brief introduction
1、 The symbol of the conflict file is “ Exclamatory mark ”
2、 Choose “ Conflict file ”, Right click —— Click on ” Resolve conflicts “—— Click on ” Open the external merge tool “( remarks : The external merge tool has been installed during the operation , At the same time sourcetree Has been configured in , See ” Integration file comparison plug-in “)
Conflict interface
The conflict resolution interface is as follows : You can select the content display type as required , only ” Show changes “,” Show conflicts “ perhaps ” All “
Resolve conflicts
Method 1 : At the relevant version , Choose ” Conflicting rows ”, The merge area is in the merge location by default , Right mouse button , Choose what remains of the final conflict , Pictured :
Effect picture after conflict resolution :
1、 The conflict icon is represented by ” Exclamatory mark ”——“ Ellipsis ”.
2、 The modified code is displayed on the right for viewing .
3、 The conflicting files modified at the same time have corresponding backups , You can download to the local , It is convenient to modify the file again in case of conflict .
remarks : Please delete the file in the version library after downloading it , Do not upload to the repository .
4、 After modifying the conflict , Need to submit again , push . When you submit , Submit valid log information , Don't take for example :123 Such information is pushed to the server .
Method 2 : If there are very few conflicts , You can resolve conflicts directly in the right column , As shown in the figure :
1、 Click the conflict file in the non staging area .
2、 Conflicting content appears in the list on the right .
3、 Select conflicting content , Resolve conflicts , As shown in the figure :
Temporary row : Means to keep the content
Discard rows : Means to delete the content
remarks : Different from the first way , When using the first method , Do not click ” No temporary files ”, Otherwise, you may not be able to open the conflict file
Version rollback
In principle, , Before code push, ensure that the local code can run , Don't push code that isn't working or has problems to the server , If due to misoperation , Push the code to the remote , Want to modify the upload code again , here , Need to roll back the version , The fallback method is shown in the figure :
1、 Switch to log / History tab
2、 Select the version to restore to , As shown in the blue position
3、 Right mouse button , choice “ Reset the current branch to this commit ”
4、 choice ” Reset mode ”, As shown in the figure
5、 Select... From the pop-up box ”Yes”
The meaning of relevant prompt information
Conflict information
Update the information first
Tips :
If push , Pull the number displayed on the upper right , You need to pull first and then push .
边栏推荐
- Keywords implements and @override
- 【Paper】2017_ Research on coordinated control method of underwater vehicle formation marine survey
- Redis implements SMS login function (I) traditional session login
- Solution to Autowired annotation warning
- Detailed explanation of the process of "flyingbird" small game (camera adjustment and following part)
- Window10 jar double click to run without response
- The role of break
- Redis实现短信登入功能(一)传统的Session登入
- [control] multi agent system summary. 5. system consolidation.
- 力扣292周赛题解
猜你喜欢
What to do when the alicloud SSL certificate expires
力扣27. 移除元素
Create a simple battle game with photon pun
Spring Festival Tourism Strategy: welcome the new year in Bangkok, Thailand
Cheap SSL certificate abroad
[UGV] schematic diagram of UGV version 32
【Paper】2013_ An efficient model predictive control scheme for an unmanned quadrotor helicopter
Malignant bug: 1252 of unit MySQL export
為什麼win10開熱點後電腦沒有網絡?
Unreal 4 unavigationsystemv1 compilation error
随机推荐
圆心科技,很焦虑?
Circle center technology, very anxious?
Thread safety and processing caused by multithreading
Redis implements SMS login function (I) traditional session login
Yolov5 torch installation
harbor api 2.0查询
【Paper】2021_ Analysis of the Consensus Protocol of Heterogeneous Agents with Time-Delays
UE4 method of embedding web pages
Keywords implements and @override
Efficiency test of adding and querying ArrayList and LinkedList
Beanfactory creation process
Sectigo certificate
redis集群概念
力扣704. 二分查找
力扣2049:统计最高分的节点数目
Unity3d realizes Google Digital Earth
How to apply for SSL certificate from the manufacturer
Universal Studios Singapore: a good place for a one-day parent-child tour in Singapore
Malignant bug: 1252 of unit MySQL export
Approaching history, introduction to the London Guard Museum