B · CollaborateIntermediate35 min read
7. Stash & conflict resolution
Git & GitHub · 48 pages source format
git stash saves WIP without committing. Conflicts: read markers, choose wisely, test after resolve.
What you'll learn
- git stash / pop
- Conflict markers
- Merge tool basics
- Post-resolve verification
Stash WIP
git stash push -m "wip login". Switch branches. git stash pop to restore.
git stash push -m "wip"
git switch main
# do other work
git switch feature
git stash popDo this now
Start edit, stash, switch branch, return, pop.
Clear?
Force a conflict
Edit same line on two branches. merge or rebase → conflict markers <<<<<<< ======= >>>>>>>.
Do this now
Create conflict in git-practice. Resolve manually. git add. Continue merge/rebase.
Clear?
After resolve
Run tests. Read full diff. Commit or continue rebase. Never leave conflict markers in code.
Do this now
Document your conflict resolution checklist in README.
Clear?