V Lecture 15 — git
V source control concepts
* source control is a way to organize and coordinate development of a set of source files
V repository (repo for short)
* an instance of the stored files
* a log of all the changes to the files
* potentially other metadata
V changeset
* updates to files in the repo are represented as deltas — the set of changes that were made
V the user controls when a set of changes officially becomes part of the repo
* at some point the user will commit changes, which incorporates them into the repo’s log
* only committed changes can be shared with other users
V distributed vs centralized
* centralized has a single authoritative repo, all changes go through this repo
V decentralized treats all repos as equal — more flexibility, but less structure
* faster because there’s no need to check with a central server
* can use decentralized as if it were centralized (what you will do for hw5)
V graph structure
* history of a repo can be represented as a directed acyclic graph (DAG)
V each commit adds a node to the graph
* each commit must be applied to some existing node
V branches allow for parallel development
* new features, experiments, specialized version
V a merge occurs when multiple nodes converge
* multiple users have each made changes and now they must be combined
V GitLab
V We’ll be using CSE’s GitLab
V git commands
V git clone
* set up your own copy of an existing repo
* git init to initialize a new repo in an existing folder
V git status
* display the status of your local repo
* files that have been changed, added, removed
* files that are not currently part of the repo
V git diff
* display what changes have been made
V git checkout
V git checkout -- FILENAME to throw away local changes
* omit FILENAME to throw away all local changes
V git add
V git treats changes as being in one of three states
* (1) not staged for commit
* (2) staged for commit
* (3) committed
V git add FILENAME moves changes to FILENAME from (1) to (2), staging them for commit
* this allows you to commit only some of the changes you have made
V git commit
* git commit -m “commit message” makes all staged changes officially part of your repo
V git push
* sends your commits to another repo
* your repo must be up to date, so git pull beforehand
V git log
* view the history of the repo
V git pull
* fetches updates from another repo and merges them into your local repo
V a merge conflict might occur if you and someone else have made changes in the same part of a file
* conflicts will be shown in the conflicted files themselves with
<<<<<<< HEAD

your version here

=======

their version here

>>>>>>> master
* you must manually resolve all conflicts and then add and commit the merged files
V hw5
* memory management (Friday’s lecture)
* required to do it in a team of 2
V midterms
* mean and median: 44 of 72
* standard deviation: 10