Summary and Schedule
This lesson is designed to support hands-on exercises on collaborative work using Git and GitLab. The exercises are best done in pairs or in small groups.
This lesson is built with The Carpentries Workbench.
Setup Instructions | Download files required for the lesson | |
Duration: 00h 00m | 1. Introduction |
What is the point of these exercises? Where do I find tutorials and documenation on Git features? |
Duration: 00h 05m | 2. Undoing things locally | Phew! Luckily I haven’t pushed yet — how can I change my commit? |
Duration: 00h 35m | 3. Undoing things once pushed | Uh-oh! I already pushed — how can I fix my commit now? |
Duration: 01h 05m | 4. Working together | How to best work on the same code? |
Duration: 01h 35m | 5. Resolving conflicts | How to solve conflicts in code? |
Duration: 02h 25m | 6. Keeping things in order | How to use issues to keep things in order? |
Duration: 02h 55m | 7. Automate testing | How to automate testing of code updates? |
Duration: 03h 25m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
GitLab account
For these exercises, you can use the CERN GitLab instance (available to CERN users, with the user name as your CERN login name), or an account on GitLab.com.
SSH key
You need to authenticate to push code to the repositories. The most convenient is an SSH key:
- Check if you have a key already and if not create a new one: https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key
- Add it to your account: https://gitlab.com/-/user_settings/ssh_keys
Working environment
Note
We expect participants to work in a local Unix environment on their laptop although working through a remote connection to a central system such as lxplus at CERN is possible for this lesson.
If you are unfamiliar with the Unix shell, you can work through the exercises in The Unix Shell tutorial by Software Carpentry.
Windows users: the Unix tutorial gives git bash
as an
option. However, for all work during the hands-on session:
- do not use
git bash
- do not use
Power shell
(apart from installing WSL2) - activate WSL2 and use the Ubuntu terminal that comes with it!
Activate WSL2 and use the Ubuntu terminal.
Use Terminal.app
Use Terminal
Prerequisites
Know how to clone or create a repository
-
Have Git configured in the local environment:
-
check with
git config --list
-
if email and name are not configured, add them with
git config --global user.name "[name]" git config --global user.email "[email address]"
(Replace
[...]
with your input, and keep the quotes around your name if there are spaces.)
-
Understand the concept of local and remote
-
Know how to add updates from the local area to the remote repository with the usual Git workflow, e.g.:
git status git add . git commit -m "Message describing your new content" git push origin main