<span dir="">For questions and information, send an e-mail to: </span><span dir="">f.muijzer@utwente.nl</span>
<spandir="">Version 2, 18-02-2022</span>
<spandir="">Version 3, </span>2023-09-29
## <span dir="">Part I: Setup</span>
## Introduction
### <span dir="">Step 1: Project Fork</span>
Welcome to the GitLab space of the Biomedical Signals and Systems group of the UT. Here we host source code of many of our projects, both to keep track of changes during development and to keep them archived when the project is finished.
<spandir="">Contact one of the BSS GitLab administrators to create a personal folder that includes a fork\*\* of each of the project repositories\* you will work on.</span>
GitLab is a website that allows you to browse trough GIT repositories. GIT is a version control system which keeps track of changes made to source code. Every time you want your changes to be added to the repository, you make a "commit" and "push" to the GitLab server. If someone else wants your changes, he/she has to "fetch" them from the GitLab server.
<spandir="">To go to your personal folder, go to the URL </span><spandir="">https://gitlab.utwente.nl/bss_development</span><spandir=""> and log in using your **student (or employee) number** and **UT password**. The admin will create a personal folder with your name in the folder ‘students’ or ‘staff’.</span>
## Working with multiple people on one project
<spandir="">You will receive an invitation via e-mail to join this folder. **After logging in on GitLab, go to this e-mail and click on the button to join the folder.**</span>
If you work with multiple people on a project, it is important everyone is up to date. If two users _fetch_ the source code on day 1, user A makes changes and _commit / pushes_ these on day 2, and user B makes changes on day 3 without _fetching_ the changes of user A first, user B will have _merging conflict_ issues _pushing_ the changes of day 3. The _merge conflict_ means the server now has two different set of changes it has to apply to the source code state of day 1. If the changes occur in different files, it can merge them, but if the changes relate to the same thing, you have to manually indicate how to merge the changes. To avoid these issues you can take two routes:
By default a repository is on the "main" _origin_. At any moment, you can create a _branch_ of the code. At start, the _branch_ contains exactly the same code as the _origin_, but the changes you apply to the branch are not applied to the origin (it's like a copy). This can be handy if you want to try out a certain feature/change, but you can also use _branches_ to keep the changes of multiple users separate.
<spandir="">Download GitHub desktop from </span><spandir="">https://desktop.github.com/</span><spandir=""> and install. When asked to create a GitHub account, press ‘skip’ (no GitHub account is required to use GitHub desktop).</span>
A user that is allowed to make changesto a _branch_, can always also make changes on the main _origin._ For larger projects, it might be useful to limit the amount of people that have the rights to change the main project, for example when this project is referred to in scientific publications. In this case, other users can work in a _fork_ of the project, and merge there changes later on. The _fork_ is also a copy of the project, but at a different location. For example for the main repository
<spandir="">GitLab will subsequently ask for a name and e-mail address. Here, use any e-mail address where you would like to receive notifications from GitHub desktop.</span>
<spandir="">To start working on a project from you own computer, go to the fork of this project that was created by the administrator in your personal BSS development folder **(you can find this folder in BSS_development/Students/<your name>/<project> or BSS_development/Students/<your name>/<project>)** and clone the project using the following steps:</span>
<spandir="">Here, paste the repository URL you copied from the GitLab website, and choose the path on your computer where you would like to store your local clone of the project. After entering both settings, press ‘Clone’.</span>
<spandir="">After pressing ‘Clone’ you will be asked for your username and password. Use your student or employee number as user name, and use your regular UT password.</span>
**<span dir="">Press ‘Fetch Origin’ to make sure all project folders are in sync.</span>**
<spandir="">Congratulations! Now you have created your own local clone of the project repository!</span>
## <span dir="">Part II: Working with GitLab</span>
### <span dir="">Write Code and Commit</span>
<spandir="">From now on, Git will track all the changes you make in the code of this project, and allows you to merge these changes with the original version of the code, when your code is ready. All you have to do, is to regularly commit your changes to GitLab, e.g. once a day.</span>
<spandir="">1. As a testcase, let’s go to the project folder and create a .txt file with the text “Hello World”.</span>
<spandir="">2. Now go to your GitHub desktop. You will see the changes to your code, or the files you created listed here.</span>
<spandir="">3. Write a good description of your changes and press ‘Commit’.</span>
<spandir="">4. Press the blue button ‘Push Origin’ that appears in the GUI, or go to ‘Repository’ (top bar) à ‘Push Origin’ to make sure your changes are uploaded to the server.</span>
<spandir="">1. Go to: </span><spandir="">https://gitlab.utwente.nl/bss_development/students</span><spandir=""> or </span><spandir="">https://gitlab.utwente.nl/bss_development/staff</span>
<spandir="">3. As name of the subgroup enter <firstinitial>\_<lastname>. Make sure that the user is listed as ‘Maintainer’, to allow the user to push changes to his personal fork. Invite student/staff member to join group via the e-mail option on the bottom:</span>
<spandir="">4. Fork repositories that the student/staff member will work on to the subgroup of the student. To do so, go to the target repository, and press ‘Fork’.</span>
<spandir="">6. To allow the user to report issues in the main project. Go to the subgroup where the main project is located and list the user as ‘Reporter’:</span>