Introduction
Advanced Git commands for managing complex projects and workflows.
Branching Strategies
# Create and switch
git checkout -b feature/new-feature
# Rebase instead of merge
git rebase main
# Interactive rebase
git rebase -i HEAD~3
# Squash commits
# In interactive mode: pick, squash, squash
Stashing
# Save work in progress
git stash save "work in progress"
# List stashes
git stash list
# Apply stash
git stash apply stash@{0}
# Apply and drop
git stash pop
Advanced Operations
# Cherry-pick commits
git cherry-pick abc123
# Bisect to find bug
git bisect start
git bisect bad
git bisect good abc123
git bisect reset
# Submodules
git submodule add https://github.com/user/repo path
Practice Problems
- Manage feature branches
- Resolve merge conflicts
- Use interactive rebase
- Find bugs with bisect
- Work with submodules