Where to Go Next
Find Help When Git Surprises You
Git will eventually print a message you have not seen before. That is not a sign that you should memorize every message in advance. It is a reason to keep a dependable way of finding out what Git knows and what a command means.
Start from the repository, not from a guess
When something surprises you inside a git status. You already know this command: it names the current
An error message often contains two kinds of information. The first part says what Git refused to do. Later lines may suggest a command or name the state that must be settled first. Treat those lines as evidence, not as an instruction to copy every command you see. A suggestion can be correct for one intention and wrong for another.
Write down the question in ordinary words before searching. “Which branch am I on?” is more useful than “Git broken.” “How does restore choose a source?” is more useful than pasting an unexplained command and hoping it applies.
Ask Git for one command’s manual
Git includes manuals for its commands. In git help <command>, the angle-bracketed word is a placeholder: replace <command> with the command you want to understand. For example, the following asks for the manual for git status:
git help status
Depending on your computer, Git may open the manual in a q to return to the prompt. Reading a manual does not change the repository.
The manual is a reference, not a lesson you must read from top to bottom. Start with the description, then look for the option or term that appeared in the message you are investigating. Stop when you can answer the question that brought you there.
Use the official web reference when that is easier
The official Git reference provides the same command documentation in a searchable web page. It is useful when the terminal viewer is unfamiliar, when you want links between related terms, or when you are reading from another device.
Version numbers matter when a manual describes behavior your installed Git does not recognize. git --version tells you which version you have, and the web reference lets you select older documentation when necessary. Do not assume that a random example and your installation have the same age or configuration.
This help habit is not a new assessment and it is not a command you must perform for the course. It is how you continue safely after the prepared exercises end: read the state, name the question, consult the relevant reference, and make the smallest change you can verify.