Git Essentials

Core concepts, commands, and end-to-end workflows for an everyday GitHub-based dev loop.

32 flashcards · select reveal or click a card to see details

basics beginner

Repository

A project tracked by git, including all of its history.
basics beginner

The Three States

Every file is either modified (working dir), staged, or committed.
basics beginner

Working tree

The working tree is the current set of files you are editing on disk.
basics beginner

Staging area

The staging area, or index, is where you choose what will go into the next commit.
basics beginner

Commit

A snapshot of your staged changes with a message.
basics beginner

git status

Shows what has changed, what is staged, and which branch you are on.
basics beginner

git log

Browse commit history.
basics beginner

git diff

See line-by-line changes.
branching beginner

Branch

A movable pointer to a series of commits, used to isolate work.
branching beginner

Merge

Pulls another branch’s changes into your current one.
branching beginner

Merge Conflict

Happens when two branches change the same lines and git can’t auto-resolve.
branching beginner

git switch

git switch moves you to another branch, or creates and moves to a new branch.
branching beginner

Rebase

Replays your commits on top of another branch for a linear history.
branching beginner

HEAD

HEAD means “where you currently are” in the repository history.
remote beginner

Remote

A version of your repo hosted elsewhere, usually GitHub.
remote beginner

Push

Sends your local commits to a remote.
remote beginner

Pull

Fetches remote changes and merges them into your branch.
remote beginner

Fetch

Downloads remote changes without touching your working branch.
remote beginner

Pull Request

A GitHub feature for proposing a merge from one branch into another, with discussion, review, and CI checks.
utilities beginner

.gitignore

A file listing patterns git should ignore.
utilities beginner

git stash

Temporarily shelves uncommitted changes so you can switch contexts.
utilities beginner

Undo Changes

Discard, unstage, or rewind, depending on how far back you need to go.
utilities beginner

Tags

Named pointers to specific commits, used for releases.
utilities beginner

gh CLI

GitHub’s official command-line tool that pairs with git for GitHub-specific tasks.
remote beginner

origin

origin is the conventional default name for the remote you cloned from.
workflows intermediate

Daily Push Flow

The end-to-end loop for adding a feature or fix and getting it merged into main on GitHub. This is the workflow you’ll run dozens of times a week.
workflows intermediate

Sync Branch with Main

Bring the latest changes from main into your in-progress feature branch. Run this every day or two so your PR doesn’t drift behind and accumulate conflicts.
workflows intermediate

Code Review Iteration

Push follow-up changes in response to PR review comments. GitHub will automatically update the PR each time you push.
workflows intermediate

Hotfix While Mid-Feature

Drop your in-progress work to ship an urgent fix, then come back to where you left off. Stash is the key tool here.
workflows intermediate

Fork & Stay in Sync

The standard workflow for contributing to a repo you don’t have write access to (typical for open source).
workflows intermediate

Undo a Pushed Commit

Reverse a bad commit that’s already on GitHub without rewriting shared history. The safe approach is to add a new commit that cancels out the old one.
utilities intermediate

Revert

git revert creates a new commit that undoes an earlier commit.