Feature Branches

Feature Branches for BookNest's API and Frontend

A feature branch holds one change: it starts from an up-to-date main, lives hours or days, and is deleted once merged, API branches first here because the search box calls /api/books?q=. Prefixes such as api/search group branches in tools, but api and api/search cannot coexist: refs/heads/api cannot be both a file and a directory. Merge the front end with --no-ff, which groups its commits under a merge commit even though a fast-forward was possible:

Merging the front-end branch and viewing the resultShell
git merge -q --no-ff -m "Merge the catalog search box" ui-search
git branch -d ui-search
git log --oneline --graph 9004c2c..
Output
Auto-merging public/index.html
Deleted branch ui-search (was 4370a11).
*   e2b46bd Merge the catalog search box
|\  
| * 4370a11 Add a title search box to the catalog page
| * 92b3d18 Escape catalog fields instead of using innerHTML
* | 3dfdfa3 Escape catalog fields instead of using innerHTML
|/  
*   1aaa0dc Merge branch 'search-api'
|\  
| * c47ef58 Document the ?q= title search
* |   cf03d34 Merge branch 'sort-api'
|\ \  
| * | 8085c86 Sort books with ?sort=price, rating or year
| |/  
* / 85afe4c Test the ?q= title search
|/  
* 7267a50 Search book titles with ?q=

The escaping change was identical on both sides, so the merge took it once. The left-hand line is main's first-parent history, one entry per feature (git log --first-parent). The merged code passes all ten tests, the check that matters: a clean merge proves only that no lines collided.