Git Recipes
View CommandsEssential version control commands for branching, committing, merging, and managing your codebase history with confidence.
10 recipes
Automate Cleanup of Stale Merged Branches
Remove local and remote branches that have already been merged, keeping your repository clean and navigable.
Selective Commit Migration with Cherry-Pick
Use git cherry-pick to selectively apply specific commits from one branch to another without merging the entire branch history.
Standardized Commit Messages with Conventional Commits
Set up and enforce the Conventional Commits specification with commitlint and commitizen for consistent, parseable commit messages.
Binary Search for Bug-Introducing Commits with Bisect
Use git bisect to perform an efficient binary search through commit history and pinpoint the exact commit that introduced a bug.
Code Archaeology and Change Tracking with Git Blame
Use git blame and git log to trace the history of code changes, understand why lines were written, and find the context behind decisions.
Pre-commit and Pre-push Hook Setup with Husky
Automate code quality checks with Git hooks using husky and lint-staged to run linters, formatters, and tests before commits and pushes.
Advanced Stash Operations for Context Switching
Master git stash to save, organize, and restore uncommitted work when switching between tasks or branches.
Managing Shared Code Across Repositories with Subtree
Use git subtree to embed and synchronize shared libraries or components across multiple repositories without submodule complexity.
Work on Multiple Branches Simultaneously with Worktrees
Use Git worktrees to check out multiple branches in separate directories, enabling parallel work without stashing or context switching.
Clean Commit History with Interactive Rebase
Squash, reorder, reword, and edit commits using interactive rebase to craft a clear, logical commit history before merging.