🌍 Git & Version Control · subject
Git & Version Control Best Practices and Troubleshooting Syllabus
Every chapter and topic of Best Practices and Troubleshooting examined in Git & Version Control — 4 chapters, 14 topics, plus 50 flashcards written against it.
Best Practices and Troubleshooting syllabus — full chapter and topic list
Expand any chapter to see its topics and sub-topics. This is the whole examinable outline for Best Practices and Troubleshooting in Git & Version Control, not a summary of it.
-
Repository Hygiene
4 topics- Effective .gitignore and .gitattributes
- Keeping a Clean History
- Atomic Commits
- Documentation and README Standards
-
Common Problems and Recovery
4 topics- Recovering Deleted Branches and Commits
- Fixing Detached HEAD State
- Undoing a Bad Merge or Rebase
- Resolving Diverged Branches
-
Workflows for Different Team Sizes
3 topics- Solo Developer Workflow
- Small Team Workflow
- Large Enterprise Workflows
-
Migration and Interoperability
3 topics- Migrating from SVN to Git
- Importing and Exporting Repositories
- Mirroring and Backups
Best Practices and Troubleshooting flashcards for Git & Version Control
25 of 50 cards from the Best Practices and Troubleshooting deck — real questions with worked answers.
What is the primary purpose of a .gitignore file?
To tell Git which intentionally untracked files or directories to ignore, preventing them from being staged or committed (e.g., build artifacts, logs, dependency folders, secrets).
How does .gitattributes differ in purpose from .gitignore?
.gitignore excludes files from tracking, while .gitattributes defines per-path behaviors for tracked files, such as line-ending normalization, diff/merge strategies, export handling, and Git LFS filters.
In .gitignore syntax, what does a leading slash (e.g., /build) signify?
It anchors the pattern to the directory containing the .gitignore file, matching only at that root level rather than in any subdirectory.
In .gitignore, what is the effect of a trailing slash (e.g., logs/)?
It matches only directories named 'logs' (and their contents), not files with that name.
How do you re-include a file that was previously excluded by a broader .gitignore pattern?
Use a negation pattern with a leading exclamation mark, e.g., '!important.log', though a file cannot be re-included if its parent directory is excluded.
Why does adding a pattern to .gitignore fail to remove a file that is already tracked?
.gitignore only affects untracked files; an already-tracked file must first be removed from the index with 'git rm --cached <file>' and then committed.
Which .gitattributes setting normalizes line endings, and what does it do?
'* text=auto' tells Git to auto-detect text files and store them with LF line endings in the repository while checking them out with the platform's native endings.
How do you mark a file as binary in .gitattributes, and what is the effect?
Use '<pattern> binary' (shorthand for '-text -diff'); Git will not attempt line-ending conversion or textual diffs on that file.
What does the 'export-ignore' attribute in .gitattributes do?
It excludes the matching paths from archives produced by 'git archive' (e.g., omitting tests or CI files from a release tarball).
Define an 'atomic commit' in Git best practice.
A commit that represents one complete, self-contained logical change—it does exactly one thing, builds/passes on its own, and can be reverted independently without breaking unrelated functionality.
List three benefits of making atomic commits.
Easier code review, cleaner and more meaningful history, and simpler debugging via 'git bisect' or targeted 'git revert' of a single change.
Which Git command lets you stage only selected portions (hunks) of a file to build an atomic commit?
'git add -p' (or 'git add --patch'), which interactively presents each hunk to stage, split, or skip.
What are the conventional structural components of a good commit message?
A concise imperative subject line (about 50 characters or fewer), a blank line, and a body wrapped near 72 characters explaining the what and why of the change.
What does 'keeping a clean history' mean, and name two techniques to achieve it.
It means a linear, readable, logically ordered commit history. Techniques: interactive rebase to squash/reorder/reword commits ('git rebase -i') and rebasing feature branches onto main instead of merging.
What is the golden rule of rebasing regarding shared branches?
Never rebase (or rewrite history of) commits that have been pushed to a shared/public branch others may have based work on, because it rewrites hashes and diverges everyone's history.
What is the difference between 'git merge' and 'git rebase' for integrating changes?
Merge creates a new merge commit joining two histories, preserving branch topology; rebase replays your commits on top of another base, producing a linear history but rewriting commit hashes.
What is a fast-forward merge, and when does it occur?
A merge where the target branch has no new commits since the branch diverged, so Git simply moves the branch pointer forward to the tip of the merged branch—no merge commit is created.
What should a good README document at minimum?
Project name/description, installation/setup instructions, usage examples, configuration, contribution guidelines, license, and how to run tests—so a newcomer can understand and use the project quickly.
What lightweight markup language is conventionally used for README files on platforms like GitHub?
Markdown (README.md).
What is the purpose of Conventional Commits, and give an example prefix.
A specification standardizing commit message format to enable automated changelog generation and semantic versioning; example prefixes include 'feat:', 'fix:', 'docs:', 'refactor:', and 'chore:'.
How can you recover a branch you accidentally deleted in Git?
Find the branch tip's commit hash using 'git reflog', then recreate the branch with 'git branch <name> <hash>' (or 'git checkout -b <name> <hash>').
What is the Git reflog, and why is it key to recovery?
The reflog is a local log recording every update to branch tips and HEAD; it lets you find and restore commits or branches that are no longer referenced by any branch, before garbage collection removes them.
How long does Git typically retain unreachable objects before garbage collection, by default?
Reachable-from-reflog entries expire after about 90 days, and unreachable objects after about 30 days (gc.reflogExpire and gc.pruneExpire defaults).
How do you recover a specific deleted commit whose hash you found in the reflog?
Reset or cherry-pick it: 'git reset --hard <hash>' to move the current branch back to it, or 'git cherry-pick <hash>' to reapply it onto the current branch.
What is a 'detached HEAD' state in Git?
A state where HEAD points directly at a specific commit rather than at a branch reference, so new commits are not attached to any branch and can be lost if you switch away.
Planning Best Practices and Troubleshooting for Git & Version Control
Best Practices and Troubleshooting is about 11% of the Git & Version Control syllabus by topic count — 14 of 127 topics, spread over 4 chapters. At roughly 45 minutes per topic plus 12 minutes per sub-topic, a first pass runs to about 10 hours.
The heaviest chapters are Repository Hygiene (4 topics), Common Problems and Recovery (4 topics), Workflows for Different Team Sizes (3 topics) . Front-load those while your energy is high; the short chapters are better revision filler later.
Work top-down: read the chapter, then tick topics off individually rather than marking the whole chapter done. Sub-topics are where silent gaps hide.
Best Practices and Troubleshooting (Git & Version Control) FAQ
What is in the Git & Version Control Best Practices and Troubleshooting syllabus?
Best Practices and Troubleshooting is split into 4 chapters — Repository Hygiene, Common Problems and Recovery, Workflows for Different Team Sizes and Migration and Interoperability, containing 14 topics and 0 sub-topics in total.
How is Best Practices and Troubleshooting structured in the Git & Version Control syllabus?
4 chapters. Best Practices and Troubleshooting accounts for about 11% of the topics in the whole Git & Version Control syllabus (14 of 127).
How long should I spend on Best Practices and Troubleshooting for Git & Version Control?
Budget around 10 hours for a first pass through Best Practices and Troubleshooting — about 45 minutes per topic plus 12 minutes per sub-topic across its 14 topics. Add revision cycles on top.
Are there flashcards for Git & Version Control Best Practices and Troubleshooting?
Yes — a 50-card Best Practices and Troubleshooting deck. Sample cards are printed on this page, and the full deck is free in the Examius app with spaced repetition scheduling.