class: center, middle, inverse # Version Control ## The evolution of GIT... --- class: inverse ## In the beginning... * Sneakernet * Here hold my tape drive --- class: inverse ## Historically * Source Code Control System * 1972 - 2006 * Bell Labs * Interleaved deltas * Good for text, bad for binary * Revision Control System * 1982 - ? * diff utility based --- class: inverse ## Historically * Concurrent Versions System (CVS) * 1986 - 2008 * Series of scripts originally using RCS * Takes a lot of flack for newer design philosophy changes * Subversion (SVN) * 2000 - ? * rename issue .center[] .footnote[.red.bold[*] [Image Source](https://medium.com/devsondevs/gitflow-workflow-continuous-integration-continuous-delivery-7f4643abb64f)] --- class: inverse ## What changed? * Distributed vs Centralized * peer to peer * working copies * communicate only when sharing changes * multiple backups * Proprietary Systems * use license changed --- class: inverse ## GIT * 2005 - ? * Linus Torvalds * full working directory * used for the linux kernel for patching * safeguards corruption (accidental or malicious) * multiple merge strategies * resolve, recursive, octopus * data structures * blob, tree (directory), commit (links tree objects into history), tag (container of metadata and reference of another object) --- class: inverse ## GIT Concepts and Practices * commit early and often * copy/move a file in a different commit from any file changes * name your stashes * git stash save (name) * don’t commit anything that can be regenerated from other things that were committed --- class: inverse ## GIT Commands * checkout * git clone ssh://user@host/path/to/repo.git * creates shortcut called origin * status * git status * adding * git add
* commit changes (local) * git commit --- class: inverse ## GIT Commands * commit changes (remote) * git push origin master * origin - remote connection to the central repo * master - branch * pull updates (conflicts) * git pull --rebase origin master * resolve conflicts * git rebase --continue * don’t panic * git rebase --abort * git push origin master --- class: inverse ## GIT Commands * Stashing * Saving your work without commit * git stash * git stash list * git stash apply * apply the previous stash to current * branches * git branch
* git checkout
* merging branches * git checkout master * git merge
--- class: inverse ## GIT Maintenance * git log * see pointers and other information * git fsck * Validates git repo * git gc * Removes dangling objects --- class: inverse ## GIT example ```bash git checkout -b proj-404 git status git add newclass.py # code changes git commit # rinse and repeat git push -u origin proj-404 # code changes git push # code changes ``` --- class: inverse ## GIT example ```bash git checkout master # checkout master branch git pull # pull changes git pull origin proj-404 # pull changes on this branch git push # pushes changes back to origin master ``` --- class: inverse ## Resources * https://git-scm.com/doc * https://en.wikipedia.org/wiki/Merge_%28version_control%29#Three-way_merge * https://sethrobertson.github.io/GitBestPractices/ * https://git-scm.com/book/en/v1/Git-Tools-Stashing * https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging ## Workflows * http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html * https://www.atlassian.com/git/tutorials/comparing-workflows/centralized-workflow