TESTING AREA for teachers - real service at plus.tuni.fi
- TIE-99001
- 4. Module 1 - Introduction
- 4.4 git: backuping and collaborating
git: backuping and collaborating¶
- Main questions:
How to store editing history? How to share your work with your colleagues?
- Topics:
git: add, commit, push, pull
- What you are supposed to do?
Learn essential use of git version control
- Difficulty:
You need basic UNIX terminal skills
- Laboriousness:
1-2 hours
Introduction to git¶
Software: git
git is a version control software. It saves the editing history of a directory: what new files were added, changes to existing files or what files have been moved. With git, many persons can edit the same collection of files at the same time and share their work.
In Aalto University, git is also used for backuping the A+ course materials and publishing changes to the A+ production server https://plus.cs.hut.fi . Git is also useful on your own computer: if you delete some file on your course folder by mistake, or break the code and don’t know how to repair it, you can revert back to an earlier version of your codebase.
There are many git tutorials for beginners. Try out these:
If you haven’t used git before, do a first-time git setup:
When you edit course material, the most needed git commands are:
git add
,git mv
git commit
git status
git pull
,git push
Recommendation: “git lol” custom command
One can configure additional commands for git. Copypaste the following command to the terminal to add new command “git lol”. It shows a nice, semi-graphical tree view of your git history, as in the picture below.
git config --global --add alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit --all"
Aalto Gitlab¶
Aalto University has a service for storing and sharing git repositories (directories with history in git). In the following, you will be guided on how to use it.
First, log in to Aalto Gitlab at https://version.aalto.fi .
Adding an SSH key¶
If you have not used Aalto Gitlab before, you need to add an SSH key.
This is a cryptografic key which enables the data exchange between your
computer and the Aalto Gitlab computer safely. It is required for making
the commands git pull
and git push
work.
Click on your profile picture circle on the top-right corner of the page and choose “settings”.
Next click “SSH Keys” on the sidebar on the left.
Click on the link “generate one” and follow the instructions.
Recommendations for git workflow¶
If you know that several persons are editing the same course as you, begin
your working day with git pull
. Make many of small commits: edit a
couple of files where the changes are related to each other, like adding
a new chapter, picture or exercise. Do git push
many times a day. This
way it is easy to record what files were changed in each editing step.
Essentially, git push
backups your work to Aalto Gitlab.
so if your laptop or workstation breaks or becomes stolen, you will only
lose a work of a few hours.