Git primer

If you are new to Git, please consider taking the course Git Open and check its Plussa page TIE-GIT. Modules 1 and 2 (totaling to 1 cr) should be enough for this course.

This page is a short overview of Git actions you will need on this course.

Version control with Git:

Git is a version control system that was created as a tool for Linux kernel development.
Today it is widely used in software industry and is also very popular in open-source projects.

Git consists of:
  • Working tree
    • Is the name for file and folder structure that is being versioned.
    • Current directory contents
  • Index / Stage / Cache
    • Staging area, where the new commit is prepared.
  • Local repository
    • A local version of the repository where versions/commits are stored. You can actually find this information in .git folder that is hidden in the worktree's root.
  • Remote repositories
    • a remote version of the repository. Remote repository is used to synchronise local repositories and store local version history to some remote location.
    • Your remote repository is called origin
    • The remote repository can be found from TUNI Course GitLab

Git tools

  • The linux-desktop servers have Git installed
    • You can run these commands in the terminal
  • The FPGA lab TC217 computers have Git for Windows installed
    • You can open the command line interface running Git Bash
    • There is also a graphical TortoiseGit, that can be reached from the Windows Explorer context menu (right click)

Git commands required for this course:

0. Git settings

  • To get started, give Git your name and email used for commits. Also set the text editor to more user-friendly nano if you're not used to vi:
  • $ git config --global user.name "Teemu Teekkari"
    $ git config --global user.email "teemu.teekkari@tuni.fi"
    $ git config --global core.editor nano 


1. Cloning your remote repository

  • You can find your own cloning link in Course GitLab
  • $ git clone https://course-gitlab.tuni.fi/compce510-fall-2025/<GROUP_NUMBER>.git


2. Sharing your changes to the Remote repository (GitLab)

  • When you want to publish and save your changed files to the Remote repository (GitLab):
  1. Add all changed/new files to Index
  2. $ git add .
  3. Commit your changes in Index to Local repository
  4. $ git commit -m "Message"
  5. Push your new commits from Local repository to Remote repository
  6. $ git push origin


3. Updating your Local repository and Working tree

  • If someone, usually you on a different machine or your groupmate, has made changes to the Remote repository, you have to update the contents of your Local repository:
  1. To update the changes made by others from the Remote repository
  2. $ git pull origin
  3. If you both have done changes in same files, it will lead to conflicts
    • Resolve the conflicts by editing the files manually and commit your changes
    • To prevent conflicts, pull the changes before editing files
    • TortoiseGit has a nice editor for resolving the conflicts


4. Updating your Local repository and Working tree with updates done by the course staff

  • From time to time, you have to get some new files from the course template repository:
  1. Add the group template repository as new remote repository called course_upstream
  2. $ git remote add course_upstream https://course-gitlab.tuni.fi/compce510-fall-2025/group_template_project.git
  3. Fetch the new Remote repository to Local repository
  4. $ git fetch course_upstream
  5. Merge the changes to your Working tree
  6. $ git merge course_upstream/main

Additional Git commands

  • Show changes in Working directory after previous commit
  • $ git status
  • Show commit history
  • $ git log
  • Show all remotes
  • $ git remote -v

Additional Git terminology

  • Branches are different history paths that diverge from the main line of development
    • The default branch is called main
  • HEAD is a pointer to the last commit made in the repository
    • The current version of the project, as known by Git
  • A commit represents one version of the project
    • Each commit contains line-level changes to files compared to the previous commit
  • Tags can be used to mark important points in project history
    • For example release points (v1.0, v2.1 and so on)
Posting submission...