Git
Version control workflows, branching strategies, and Git command snippets.
17 snippets
Showing 17 of 17 snippets
Undo Last Git Commit (Soft and Hard)
Git commands to undo the last commit while keeping changes staged, unstaged, or fully discarded.
Git Rebase Workflow Example
Step-by-step git rebase workflow to keep feature branches up to date with main branch cleanly.
Git Cherry-Pick Commits Example
Apply specific commits from one branch to another using cherry-pick with conflict resolution.
Squash Multiple Git Commits
Interactive rebase to squash multiple commits into one clean commit before merging a feature branch.
Git Stash Usage Examples
Save, list, apply, and manage uncommitted changes with git stash for quick context switching.
Rename Git Branch (Local and Remote)
Commands to rename a local and remote Git branch including updating tracking references.
Delete Remote Git Branch
Commands to delete local and remote branches, prune stale references, and clean up merged branches.
Resolve Git Merge Conflicts
Step-by-step guide to identify, resolve, and complete merge conflict resolution in Git.
Git Interactive Rebase Guide
Interactive rebase to reorder, edit, drop, and squash commits for a clean Git history.
Git Revert Commit Safely
Create a new commit that undoes changes from a previous commit without rewriting history.
Git Reset and Restore File Changes
Commands to discard, unstage, or restore file changes using git restore and git checkout.
Git Force Push Safely
Use force-with-lease instead of force push to prevent overwriting teammates' commits on remote.
Git Clone Specific Branch
Clone a specific branch from a remote repository without fetching all branches and history.
Git Shallow Clone for Large Repos
Shallow clone techniques to reduce download size by limiting commit history depth.
Git Hooks Pre-Commit Example
Git pre-commit and commit-msg hooks to enforce linting, tests, and commit message conventions.
Git Bisect to Find a Bug
Use binary search through commit history with git bisect to find the exact commit that introduced a bug.
Git Worktree for Multiple Branches
Work on multiple branches simultaneously using git worktree without stashing or switching.