Commit 52ad7c21 authored by Belhorn, Matt's avatar Belhorn, Matt
Browse files

Adds outline of topics to cover for staging talk.

parent 4c0720c4
# Staging
## Synopsis
Git expects content to be moved to a special state called the *staging area*
before it can be committed. Understanding the differences between what is
in the staging area and what you see on disk can sometimes be tricky for new
users. In this talk, we show how to use the staging area to control what gets
committed and what does not.
## Concepts
- Trees
- A tree is a equivalent to a directory structure and it's contents.
- Tree objects: object consisting of list of filepaths and associated file content blobs.
Example: HEAD (a ref to latest committed index state on branch)
- Working tree: The tree of (contents of HEAD + local uncommitted changes)
- Index (Staging Area)
- Collection of tracked file contents in a working tree.
- HEAD + staged tree/blob objects
- Different from working tree:
- untracked files (present in working tree, but no entries in index)
- 'dirty' files
- files modified since last committed index (have entries in index, but working tree differs from HEAD)
- renamed (moved) files (file name in index no longer matches filename in working tree)
- deleted files (have entries in the index, but removed from working tree)
- merge conflicts (index entries with different contents across multiple worktrees)
- Commit/Git History
- A single point in history of index states.
- New commits formed from HEAD + (diff blob objects of current index entry states).
- New commits advance HEAD ref to point at the new commit.
- Stashes
- Saves detatched blobs for changes between (working tree + index) and HEAD and resets to HEAD.
- Avoid this. It's better to commit these changes to a new WIP branch right away:
git checkout -b "my_work-in-progress"
git commit -am "WIP: Useful message about what you were doing"
git checkout $LAST_BRANCH
You can always amend the initial WIP commit when you get back to working on it.
- Alternatively:
git stash save "my-stash"
# some time later.
git stash branch "my_work-in-progress" "my-stash"
## Commands
- `git ls-files` lists the index
- `git add [--patch]`
- `git rm [--cached]`
- `git status`
- `git reset`
- `git mv` (`git rm; git add`)
- `git commit`
- `git update-index`
- `git worktree`
## Advanced Topics
* Main and linked worktrees
* Bare repositories
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment