🔀

Git

Version control workflows, branching strategies, and Git command snippets.

17 snippets

Showing 17 of 17 snippets

bashbeginner

Undo Last Git Commit (Soft and Hard)

Git commands to undo the last commit while keeping changes staged, unstaged, or fully discarded.

#git#undo
bashintermediate

Git Rebase Workflow Example

Step-by-step git rebase workflow to keep feature branches up to date with main branch cleanly.

#git#rebase
bashintermediate

Git Cherry-Pick Commits Example

Apply specific commits from one branch to another using cherry-pick with conflict resolution.

#git#cherry-pick
bashintermediate

Squash Multiple Git Commits

Interactive rebase to squash multiple commits into one clean commit before merging a feature branch.

#git#squash
bashbeginner

Git Stash Usage Examples

Save, list, apply, and manage uncommitted changes with git stash for quick context switching.

#git#stash
bashbeginner

Rename Git Branch (Local and Remote)

Commands to rename a local and remote Git branch including updating tracking references.

#git#branch
bashbeginner

Delete Remote Git Branch

Commands to delete local and remote branches, prune stale references, and clean up merged branches.

#git#branch
bashintermediate

Resolve Git Merge Conflicts

Step-by-step guide to identify, resolve, and complete merge conflict resolution in Git.

#git#merge
bashadvanced

Git Interactive Rebase Guide

Interactive rebase to reorder, edit, drop, and squash commits for a clean Git history.

#git#rebase
bashbeginner

Git Revert Commit Safely

Create a new commit that undoes changes from a previous commit without rewriting history.

#git#revert
bashbeginner

Git Reset and Restore File Changes

Commands to discard, unstage, or restore file changes using git restore and git checkout.

#git#reset
bashintermediate

Git Force Push Safely

Use force-with-lease instead of force push to prevent overwriting teammates' commits on remote.

#git#force-push
bashbeginner

Git Clone Specific Branch

Clone a specific branch from a remote repository without fetching all branches and history.

#git#clone
bashbeginner

Git Shallow Clone for Large Repos

Shallow clone techniques to reduce download size by limiting commit history depth.

#git#shallow-clone
bashintermediate

Git Hooks Pre-Commit Example

Git pre-commit and commit-msg hooks to enforce linting, tests, and commit message conventions.

#git#hooks
bashadvanced

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#bisect
bashadvanced

Git Worktree for Multiple Branches

Work on multiple branches simultaneously using git worktree without stashing or switching.

#git#worktree