⬇️ git pull = git fetch + git merge
Team members push changes. git pull downloads and merges. Keep your local repo up to date.
📝 Basic Pull
# Pull from default remote git pull # Pull from specific remote and branch git pull origin main # Pull and rebase (instead of merge) git pull --rebase # Pull with no merge commit (fast-forward only) git pull --ff-only # Pull with commit message git pull --no-edit # Pull and display stats git pull --stat
🎯 Pull Workflow
1. Check current branch git branch 2. Commit your changes git add . git commit -m "Your changes" 3. Pull latest changes git pull origin main 4. Resolve conflicts (if any) - Edit conflict files - git add . - git commit 5. Push your changes git push origin main # Pull without committing (stash) git stash git pull git stash pop
💡 Tips
- Pull before starting new work
- Pull before pushing
- Use git pull –rebase for cleaner history
- Resolve conflicts immediately
- Pull frequently to avoid big merges
“Forgot to pull, push rejected. Pulled, merged, pushed. Now always pull before push. Essential for collaboration.”
