Commits
A good commit starts with a good selection of changes. These guides cover the staging area, partial staging, and how to correct the last commit without losing track of what changed.
Git add and staging: prepare exactly what goes into your next commit
Learn how git add moves changes into the Git staging area, how to check them with git diff --cached, and how to split your work into clean commits.
Git reset hard vs soft vs mixed: the difference
Git reset hard, soft or mixed: what each mode does to HEAD, the index and your changes, how to undo a commit, and how to recover it with git reflog.
Git revert commit: undo a pushed commit on GitHub
Git revert commit undoes a pushed commit with a new one, without rewriting history: the last commit, a merge, several commits, conflicts.
Git undo last commit: reset local commits, revert pushed
Git undo last commit: git reset keeps or drops your local changes, git revert undoes a commit already pushed. Commands, effects and how to recover.
Git commit amend: change the last commit message or content
Use git commit --amend to fix the last commit message or add a forgotten file, see why the commit ID changes, and what to do if it was already pushed.
Git diff staged: review the changes in your next commit
Git diff staged shows what your next commit will contain. Compare git diff and git diff --cached on a partially staged file, then read it in GitMini.
Git add patch: stage only part of a file
Use git add -p to stage only part of a file: pick hunks with y and n, check what is staged, and select hunks visually in GitMini.