Practical introduction to version control
Slides originally by Felix Grund
A system that records changes to a file or set of files over time so that you can recall specific versions later
I'm done
changing
InsideFacade
Ok I'll do
my changes
now...
:(
You overwrote
my changes!
Version control systems help us a lot in development. We wouldn't be where we are today without them.
Distributed version control system
Others: SVN, CVS, Mercurial
Hosting service for Git repositories
Others: Bitbucket, GitLab, SourceForge
GitHub is a service for projects that use Git
Git and Github are sometimes confused by but they are two completely different things.
Communicating with remote
Not communicating with remote (only local)
Left side: needs no connection to hosting service (i.e. no internet)
Right side: needs this connection
Modified
Staged
Committed
(Unmodified)
Unmodified
Edit files
git add
git commit
In Git, a file is always in one of the following states:
File wasn't changed since the last commit
File was changed since the last commit
Changes to the file were staged
Changes in the staging area were committed to the local repository
Nothing modified
Change files
=> files are modified but not staged
git add src/Math.ts
git add test/Math.spec.ts
=> files are on the stage
git commit -m ...
=> files are committed
All these interactions do not communicate with remote! As long as we don't push they remain local!
A branch is nothing more than a sequence of commits. When we merge branches we just copy all commits in branch A into the history of branch B
Harry-Local
Sally-Local
Remote
(e.g. Github)
git push origin master
git pull origin master
Name of remote
Name of branch
Issue
Branch
PullRequest
Specification
(e.g. in Wiki)
Continuous Integration (CI)
Old 310 issues
Example: issue for the red box in the reference UI
https://github.students.cs.ubc.ca/CPSC310-2019W-T2/GitTesting