kb/workflow
The everyday Git cycle with status, add, commit, and log: you edit files, run `git add` to stage a commit, `git commit` to record it, `git status` to see where things stand, and `git log` to read the history. These are the commands you reach for every single day.
A commit that makes one logically complete change. Every atomic commit can be safely reverted, and the build and tests pass on every one. This is the foundation of a healthy Git history.
A commit message format: `<type>(<scope>): <subject>`. Enables automatic changelog generation and semver bump selection at release time. The standard dates from 2018 and is supported by most release tooling.
Moves file changes from the working tree into the index (staging area). Does not commit anything. It only controls what goes into the next commit.
Captures what is in the index as a new commit object and moves the current branch to that commit. Without arguments it opens an editor for the message; the most common form uses `-m`.
Rewrites the last commit: changes the message, folds in forgotten edits, or updates the content. Creates a new object with a new SHA. Safe before push; dangerous after.
Shows differences between two versions. Four main modes: no flags (working tree vs index), `--staged` (index vs HEAD), `HEAD` (working tree vs HEAD), `<A> <B>` (commit vs commit). Plus options for filtering, output formats, and branch comparison.
Traverses the commit graph and prints each commit. By default it starts at HEAD and follows parents. A dozen flags cover 95% of history-browsing scenarios.
Saves uncommitted changes to a special stack and cleans the working tree back to HEAD. Useful when you need to switch branches urgently but are not ready to commit.
Shows the difference between three Git zones: what is modified in the working tree, what is staged in the index, and which branch is active. The safest command in Git: it changes nothing and you can run it as often as you like.
A versioning convention: `MAJOR.MINOR.PATCH`. PATCH is for backward-compatible bug fixes, MINOR for new backward-compatible functionality, MAJOR for breaking changes. Adopted by most libraries.