Skip to content

Latest commit

 

History

History
117 lines (75 loc) · 2.79 KB

lec05.md

File metadata and controls

117 lines (75 loc) · 2.79 KB

Lecture #5: Introduction to Version Control with Git

Lecture Objectives

  1. Describe the purpose and benefits of version control

  2. Describe the differences between centralized and distributed version control

  3. Describe the purpose of the required configuration settings for git

  4. Be able to initialize a new local repository

  5. Describe the different stages of a typical local editing workflow

  6. Perform an iteration of the local editing workflow

  7. Browse the log of a repository

  8. Reverse changes at different stages of the editing workflow

  9. Configure the repository to ignore specific files

Textbook Reference

Chapter 15, Pgaes 349-365

Activities

  1. Introduction to version control

    a. What is version control

    • backup a changing set of files
    • store and access an annotated history of those files
    • manage merging of changes between different set of changes

    b. Centralized vs Distributed

  2. Configuring git

    • set user name, email and editor
  3. Why git in pure local configuration

  4. Make your first git repository

    • go to your ep476-sandbox
    • make a new directory planets and change to that directory
    • initialize with git init
    • explore what changed: ls -a & git status
  5. Discuss typical git workflow: edit, add, commit

  6. Make your first commit

    • make a file mars.txt that says "Cold and dry, but everything is my favorite color"
    • check the status - discuss
    • add the file
    • check the status - discuss
    • commit the file
    • check the status - discuss
  7. Review all changes

    • git log - discuss
  8. Make your first changes

    • edit mars.txt to add "Two moons will make for interesting tides."
    • check the status - discuss
    • git diff - discuss
    • git commit - does nothing - why?
    • git add
    • git commit
    • git status - discuss
    • git log
  9. Make another change

    • edit mars.txt to add "Low humidity may make it hard to grow plants"
    • git add
    • git status
    • git diff - where are the changes
    • git diff --staged
    • git commit
    • git log - different variations: --oneline and --oneline --graph --all --decorate
  10. Exploring the history

    • commit hashes
    • diff from a specific hash
    • HEAD and HEAD~n as shortcuts
    • show a specific commit
  11. Undoing changes

    • fresh changes - checkout
    • staged changes - reset
    • commited changes - revert
  12. Ignoring files (removing clutter, avoiding mistakes)

    • add a file called 'mars.dat'
    • assuming we don't want to include these files in the repo
    • create a file called '.gitignore'
    • git status
    • add *.dat to this file
  13. Discuss typical branching workflow: branch/checkout, {local edit}, merge

  14. Create a branch

    • git branch venus
    • git checkout venus