In the basis of this article lies concept of using GIT repository for development: dedicated server stores repository and project team downloads/uploads changes from/to it. SourceTree is an application that helps to work with Git repositories in a visual and user friendly way.
Prerequisites
- You should have been installed SourceTree program (https://www.sourcetreeapp.com)
- You have access to stash (https://services.burti.lv/stash/projects)
How to get the project code on your machine
Please log into services.burti.lv/stash:
Choose a project from the project list.
You will be able to see only the projects you have access to:Choose a Repository.
Since one project may contain several repositories the list of available repositories is displayed:On the left side under Actions, please click Clone button to clone (copy) repository to your computer.
Please note that under the "Source" label there is a dropdown, where you can select the branch you would like to clone from.
Go through manual Usage of Git master and develop branches in code deployment to get an overall understanding about branch concept and how we use it.Please note that stash will show you all files that repository has. Usually it will just contain "halcust" folder, but sometimes also "halpatch" and other folders if they are needed for customisations of your system.
- A window with repository URL a button Clone in SourceTree will appear.
Click on Clone in SourceTree. - If Browser asks for permission to launch your SourceTree program, please Click on Launch Application.
If you don't want to see this window again you may mark Remember my choice for all links of this type. Then a window will appear where you need to choose:
- Checkout branch (see point 4.)
- Destination Path (specify location where local files from repository will be stored)
- Bookmark Name (local name for repository: since there can be several projects you are working on, please choose convenient name for this repository).
Then click Clone button.
Proceed to the destination path you have selected in the previous step.
If running a test environment on the same machine you are cloning this code to - you may either use symbolic links to link needed folders to your development environment or just copy the folders there.
Due to the fact git folders may contain sensitive information about the repository and user credentials we do not recommend however to send copies of these git folders to somebody else. If you wish to do that - please refer to part Creating an archive.
Please note next time when you run SourceTree program you may select repositories with bookmark names defined earlier (please see step 7) i.e. you don't have to repeat points 1 to 7 again.
Basic usage of SourceTree
[-] To switch between branches double-click the required branch. If you don't see it under the BRANCHES section it means you have not checked it out from the server. For this expand the origin under REMOTES, find the needed branch and double-click it to check it out locally.
he branch in bold is the active branch. When switching to another branch it changes the code in all the folders accordingly. I.e. if you are using symbolic links - code of your system is changed at that point already.
[-] To refresh repository status (i.e. see if there are any changes) click on the Fetch button (this will not update files on local machine yet)
[-] Use the Pull button to download the changes from repository to the local branch (selected in the step 7)
Creating an archive
In the case when you need to create an archive of repository for instance to be send to another party, please do the following:
- Open the SourceTree program
- Select needed repository which needs to be archived
- In the top menu select Repository -> Archive...
- Press the "..." button and please select location and the name of the archive.
- You can find the repository's archive under location you have been specified.