Version control with Git and GitHub
Gerard Capes
Course timing
- 09:00 – 12:00 Morning session
- 12:00 – 13:00 Lunch
- 13:00 – 16:00 Afternoon session
Teaching methods
- Interactive, workshop-style course
- Code along with the examples
- Test your understanding in the exercises
- Course notes
- All examples and exercises are in the notes
- Slides will remain online after the course
Getting help
- Sticky notes/zoom reactions
- Used for getting help and giving real-time feedback
- Green = OK, ready to continue
- Red = too fast, don’t understand, computer says no etc
- Please interrupt me to ask questions
- Peer learning
- During exercises, please help each other as required
- Please try to be quiet during worked examples so everyone can
hear
What is a version control system?
- Version control is a piece of software which allows you to record
and preserve the history of changes made to directories and files.
- If you mess things up, you can retrieve an earlier version of your
project.
Storing versions without VCS
- Save a copy elsewhere?
- Save with a different name?
- How do you name different versions?
- What’s different between them?
- Many of copies of nearly-identical but critically different
files.
Why use version control
To store versions properly
- VCS treats files as one project - one current version on disk,
previous versions and variations are saved in a repository
- VCS starts with a base version of the project, and only saves the
subsequent changes you make
- In order to save a new revision, a commit message is required, which
explains why the changes were made.
Changes are saved
sequentially
Different versions can be
saved
Multiple versions can be
merged
Why use version control?
- Restore previous versions
- Understand what happened
- Backup
- Collaboration
Before we get started
- Example scenario
- Text files vs binary files
- Git vs GitHub
Check setup was a success
Hi yourusername! You've successfully authenticated, but GitHub does not provide shell access.
Why learn the commands?
The staging area
Switching to a
previous commit: “detached HEAD”
Branches
Revert
Create a new commit
Reset
Delete commit(s)
Rebasing
Merge vs rebase
Standard merge
Rebase onto master
(FF) merge after rebase
Forks and Pull Requests