Git and TPCCLIB

Git is used as version control system for TPCCLIB CLI tools, and the static PET data analysis and modelling www site. The Git repositories can be found in https://gitlab.utu.fi/users/vesoik/projects.

The source codes can be downloaded from the GitLab repository without installing Git on your own computer. Follow the instructions on this page only if you intend to edit the source codes and commit the changes to the repository.

Installing Git

Linux

In Linux, Git is already installed. For other necessary tools, follow the instructions on installing tools for building TPCCLIB in Linux or WSL.

Windows

In Windows, Git can be installed via MSYS2, which is a software building and distribution platform, that is needed to build the TPCCLIB library and PET analysis www pages. Follow the instructions on installing MSYS2 for TPCCLIB. There the Git is installed among other tools, but it could also be installed in MSYS2 separately with command

pacman -S mingw-w64-ucrt-x86_64-git

Setup Git

After installing Git, set your user identification, for example:

git config --global user.email "vesoik@utu.fi"
git config --global user.name "Vesa Oikonen"

You may also configure Git to leave the line endings as they are in the repository:

git config --global core.autocrlf false

In order to commit any changes to GitLab repository, you may also need to create and set ssh key. The ssh key is not necessary for working with the repository only locally.

Clone the TPCCLIB codes from Git repository

Create a git folder on your local disk, preferably under your home folder (/c/Users/username/ in Windows MSYS2, or /home/username in Linux).

Linux

Under the git folder, create a folder for TPCCLIB, and clone the repository into a new folder src:

cd ~/git
mkdir tpcclib
cd tpcclib
git clone https://username@gitlab.utu.fi/vesoik/tpcclib.git src

If you do not intend to edit the source codes and commit the changes, then you should clone the latest release version of the source codes, for example:

git clone --depth 1 --branch 0.8.2 https://gitlab.utu.fi/vesoik/tpcclib.git src

Windows

In Windows MSYS2 terminal, use the same commands, except for the path, if you use the Windows home path instead of the MSYS2 home path:

cd /c/Users/username/git

Clone the codes for the static PET data analysis www site

In the terminal, go to the git folder, created before, and clone the repository into a new folder petanalysis:

git clone https://username@gitlab.utu.fi/vesoik/petanalysis.git petanalysis

or if you do not intend to commit any changes then simply clone the latest repository:

git clone --depth 1 https://gitlab.utu.fi/vesoik/petanalysis.git petanalysis

Committing code changes

In Linux or MSYS2 terminal, go into your code directory, for example git/tpcclib/src or git/petanalysis. Check what was changed:

git status

To check what changes were made to a certain file:

git diff path/file.c

If you created new files, add those to git

git add newfile.c newfile.h

If you need to remove files that are already in git

git rm filetoremove.c

If you make a mistake, and want to get back to the versions that you last committed, enter command:

git reset --hard

Commit the changes and tell what you did and why

git commit -am "I changed this because I wanted to" path/file.c

or if you don't want to comment the change

git commit --allow-empty-message -m '' path/file.c

and then push the changes into the remote repository

git push

Updating local code base

If codes are previously cloned on the local folder, and the contents on the server might have changed after that, you should update the local repository from the server before any editing. If you wish to check if the remote repository is ahead of your local repository:

cd git/tpcclib/src
git remote update
git status

To update the local repository from the server (whether the previous commands were given or not):

cd git/tpcclib/src
git pull

If you want to discard any changes in your local repository, forcing the local branch to match exactly the remote, enter commands:

git fetch
git reset --hard origin

See also:



Tags: , , ,


Updated at: 2026-10-09
Created at: 2026-10-09
Written by: Vesa Oikonen