02-01: Git Concepts

Matt Price

In this section

  • collaboration
  • remotes
  • branches
  • commits
  • worktree vs. repository

Collaboration

distributed-vc.png

Concepts: Remote

01.svg

Classroom Network

gh-lpatop.svg
gh-degen-network.svg
gh-abbrev-network.svg
gh-full-network.svg

Branches

01.svg
  • git history is a tree, not a straight line
  • nothing is ever lost!!
  • can be hard to figure out!
gh-branch.svg

Concepts: Commit

01.svg
  • changes aren't saved automatically; manually “commit”
  • every commit can be revisited later
  • a branch is really just a “pointer” to a specific commit (complicated)
commits.svg

Activity Commits

commits.svg

Concept: Worktree and Repository

what you see worktree.png

what's underneath objects.png

Pointers and objects (git is a database)

git-refs.png

5e7ed7e34f9a8b34d26f98275a21afdcac171b83

git-history.png
git-objs.png

Git Workflows

In this section

  • merging
  • pulling
  • pushing

Concepts: Merge

Branch-1.png
  • when we “merge” two branches, the changes from one are brought over into the other
merge-conflict.png
  • if work has progressed on both branches, then there might be incompatible changes
  • these are called "merge conflicts"
  • they suck!

Concepts: Pull and Push Changes

git-push0.svg
git-push1.svg
git-push2.svg
git-push3.svg

Concepts: Pull and Push collaboratively

02.svg
gh-pull.svg
bubble%20diagram-01.svg

Pull and Push, the repo, and the worktree

  • pulling attempts to impose changes from a branch in one repo onto a branch in another repo.
  • first it adds the commit objects from the remote object into its own store of objects
  • then it tries to update the pointer at the tip the branch
  • if it succeds, yay!
  • if not – conflict, and new commits will be created after conflicts are resolved.