当前位置:网站首页>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 .
边栏推荐
- The subsystem implementing transaction persistence in DBMS is ()
- Oculus quest2 development: (I) basic environment construction and guide package
- 图的一些表示方式、邻居和度的介绍
- On mask culling of unity
- Method of applying for code signing certificate by enterprise
- Royal Albert Hall, a popular landmark in London
- Output directory of log files after unity3d packaging
- Unity realizes rotation and Revolution
- Detailed explanation of the process of "flyingbird" small game (camera adjustment and following part)
- Some books you should not miss when you are new to the workplace
猜你喜欢

Using the command line to convert JSON to dart file in fluent

Oculus quest2 development: (I) basic environment construction and guide package

What to do when the alicloud SSL certificate expires
![[fpga] implementation of IIC read / write EEPROM](/img/6a/36e9355058a90d98cffafcbaa1930b.png)
[fpga] implementation of IIC read / write EEPROM

HTC vive cosmos development - handle button event

National Museum of Singapore - give you spiritual and physical satisfaction

Check London attractions suitable for parents and children in winter vacation

Geotrustov wildcard

One command to run rancher
![[UAV] kinematic analysis from single propeller to four rotor UAV](/img/32/1a88b102f832ffbbc1a7e57798260a.jpg)
[UAV] kinematic analysis from single propeller to four rotor UAV
随机推荐
【Paper】2019_ Consensus Control of Multiple AUVs Recovery System Under Switching Topologies and Time D
Foreign SSL certificate
Photon pun refresh hall room list
Unreal 4 learning notes - set player birth point
[fpga] implementation of IIC read / write EEPROM
一条命令运行rancher
Solution to the 292 week match of Li Kou
【Paper】2006_ Time-Optimal Control of a Hovering Quad-Rotor Helicopter
Deeply understand the function calling process of C language
Thread safety and processing caused by multithreading
Unity script life cycle and execution sequence
PS1 Contemporary Art Center, Museum of modern art, New York
力扣349. 两个数组的交集
Static keyword
Some books you should not miss when you are new to the workplace
Paging query, using jdbc-- paging query
Unreal 4 learning notes - Animated Montage
Beanfactory creation process
Output directory of log files after unity3d packaging
Geotrustov wildcard