


Introduction to GitHub and Version Control
Assistant Professor at Charles University
Head of 🧑💻Laboratory of Quantitative Ecology

😸Code on GitHub: OndrejMottl/VersionControl_FZU_November2025
🖼️Slides: bit.ly/mottl_prez_fzu_202511
It is all about keeping track of changes 📓✍️
03:00 
Each “paper” is a single project.


Follow instructions in Version Control - git hell (a separate presentation).
Getting all the necessary software installed, configured, and playing nicely together is honestly half the battle … Brace yourself for some pain
GUI = Graphical User Interface
I will be showing you how to use:
You still can use the shell.

Activate git for a repo
05:00 A commit is a record of a change
If you create or edit a file in your repository and save the changes, you need to record your change via a commit

Chess move diary:

Pawn to d4

Edit line 32 of file A


Make a change to a file and save it. Now stage the change:
05:00 Commit (record) staged changes:
$ git log --stat
commit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
Author: Scott Chacon <schacon@gee-mail.com>
Date: Sat Mar 15 16:40:33 2008 -0700
Remove unnecessary test
lib/simplegit.rb | 5 -----
1 file changed, 5 deletions(-)
commit a11bef06a3f659402fe7563abf99ad00de2209e6
Author: Scott Chacon <schacon@gee-mail.com>
Date: Sat Mar 15 10:31:28 2008 -0700
Initial commit
README | 6 ++++++
Rakefile | 23 +++++++++++++++++++++++
lib/simplegit.rb | 25 +++++++++++++++++++++++++
3 files changed, 54 insertions(+)SHA - unique identifier
Author - who has done this?
Date - when was this done?
Message - description of what has been done
Stats - what has changed?
05:00 Commits are quick and cheap. Therefore:

Now we need to sync changes with the remote using PUSH
Add a remote to existing local repo (only once):

Push local to remote (GitHub):

Add a remote to existing local repo (only once):

Push local to remote (GitHub):

05:00 Now we need to sync changes from the remote to local using PULL
README - description of the project
.gitignore - list of files ignored by GitHub (more about it later)
license - tell other what they can do with your code
05:00 Github allows you to specify roles and permissions of your repo.
05:00 Copy (download) from remote repo to local machine
Example of online repo: OndrejMottl/VersionControl-playground
05:00 A merge conflict can occur when you are changing the same line in one file differently.
To https://github.com/picardis/myrepo.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/picardis/myrepo.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.a good strategy to avoid such conflicts:
Merge conflicts cannot always be avoided (but can be mitigated by branches; later).
How to undo last commit?
Variant A: I commited but NOT pushed yet.
How to undo last commit?
Variant B: I commited AND pushed already.
The default branch is called main or master
Switching between branches is sometimes called (checkout)
‼️ Make sure that you have all changes commited before switching ‼️
05:00 Request to merge a branch
After you push new branch, you should have a green button Compare & pull request on GitHub
Now you can add more commits on GitHub, (add Comment to start discussion), or merge the branch.
25:00 You can use Markdown on GitHub in the description and comments
More details on Github Docs

A tool to review on GitHub suggested changes
On someone else’s PR on GitHub, you can comment on individual lines or whole files
Merge conflict with branches is much more pleasant😎
Edit the file as needed
Commit the changes
05:00 We can delete branch directly on GitHub after merging
We can also delete branch before merging
05:00 

Introduction to GitHub and Version Control
28.11.2025

