This class introduces the basics of managing our code, especially in the presence of
- multiple versions of our codebase, that always exists in any non trivial software, and
- the need of collaborating with others
Specifically, we review the tools and services git and github, that were created to facilitate the "multi-person construction of multi-version software", to use Parnas' terminology.
At the end of the class you should be able to:
- understand and elaborate on the benefits of a versioning and collaboration system
- understand how to use git and github
- understand how to use them "properly" (when it makes sense to commit, when it makes sense to branch, to fork, etc)
- become confident in versioning and experimenting with code and with interacting with others on the same codeabse
- understand some "best practices" for structuring a git project in terms of branching and merging strategies
Specifically, you will learn the following commands - and underlying concepts/motivations:
- init - how to start an empty repo
- clone
- status
- log
- checkout
- diff
- add - and why we have a staging area, how to use it
- commit - and commit strategies, when it is proper to commit
- merge - and solving merge conflicts
- branch - and when to branch/merge
- pull, push
- remote - setting up a remote repository
- rebase - and why/when to use it
- reset (and reset hard): when and how to revert to a state
- stash
- how/why to fork and perform pull requests
Very important: you must be able to use these commands from the command line. Otherwise you don't really understand what's happening
Reading material - required for exam
Additional readings and material
Practicing with git and github
- Here is a very nice webapp to learn git branches in an interactive way https://learngitbranching.js.org/
- The best way to practice is, as usual, to practice. Fork a repository on github, modify it, stage and unstage changes, create branches, etc.
- Review your familiarity of the concepts and practice with some sample exam questions on proprofs.