Agent context packet

Structured metadata, source alternates, graph links, headings, series position, and diagram inventory for crawlers and agent readers.

Table of contents

  1. Daily
  2. Branching
  3. Checking History
  4. Undoing Things
  5. Working with Remotes
  6. Stashing
  7. Useful Aliases
  8. Sources

Entry facts

Kind
snippet
Maturity
budding
Confidence
high
Origin
ai-drafted (AI-drafted, human-reviewed)
Author
Agent
Directed by
krow
Published
Modified
Words
444 (3 min read)
Tags
git, reference
Full corpus
/llms-full.txt
Readable corpus
/source/full-corpus/

Graph links

Related building-krowdev-with-agentsagentic-coding-getting-started

Tagsgit, reference

Git Commands I Actually Use

The 20% of git that covers 95% of daily work — no theory, just commands.

/ directed by / / 3 min read
Topics git reference

Daily

Terminal window
# What changed?
git status
git diff # unstaged changes
git diff --staged # staged changes (about to commit)
# Commit
git add -p # stage hunks interactively — review what you're committing
git commit -m "message"
# Sync
git pull --rebase # pull without merge commits
git push

Branching

Terminal window
# Create and switch
git checkout -b feature/thing
git switch -c feature/thing # modern equivalent
# Switch back
git checkout main
git switch main
# Delete after merge
git branch -d feature/thing # safe — refuses if unmerged
git branch -D feature/thing # force — deletes regardless

Branching becomes especially important with agentic coding workflows — each AI agent runs in its own branch or worktree so they can’t step on each other’s work.

The review habit in Reviewing AI-Generated Code starts with git diff, and the larger project workflow in What I Learned Building krowdev with AI Agents depends on these commands staying boring and reliable.

Checking History

Terminal window
# Recent commits
git log --oneline -10
git log --oneline --graph --all # visual branch topology
# What changed in a commit?
git show abc1234
git show abc1234 --stat # files only, no diff
# Who changed this line?
git blame src/lib/auth.ts
# Search commit messages
git log --grep="fix auth"
# Find when a string was added/removed
git log -S "functionName" --oneline

Undoing Things

Terminal window
# Unstage a file (keep changes)
git restore --staged file.ts
# Discard local changes to a file
git restore file.ts
# Amend the last commit (message or content)
git add forgotten-file.ts
git commit --amend
# Undo last commit but keep changes staged
git reset --soft HEAD~1
# Undo last commit, unstage changes
git reset HEAD~1

Working with Remotes

Terminal window
# See what's out there
git remote -v
git fetch --all
# Check divergence from upstream
git rev-list --left-right --count main...upstream/main
# Output: "18 29" means 18 ahead, 29 behind
# Rebase onto upstream
git fetch upstream
git rebase upstream/main

Stashing

Terminal window
# Save work in progress
git stash
git stash push -m "wip: auth refactor"
# Get it back
git stash pop # apply and remove from stash
git stash apply # apply but keep in stash
# List stashes
git stash list

Useful Aliases

Add to ~/.gitconfig:

[alias]
s = status --short
l = log --oneline -20
d = diff
ds = diff --staged
co = checkout
cb = checkout -b
amend = commit --amend --no-edit
last = log -1 --stat
branches = branch -a --sort=-committerdate

Sources

Diagram

Drag to pan · scroll or pinch to zoom · Esc to close