- No commits/pushes to master 🚫
- Every feature (or every fix, anything new from master) is a new branch
- Never re-use branches
- Commit often (every time you’re happy/your code working). Remember, commits are “saves” or “snapshots” of your local code, something for you to rollback to if something breaks and also to track your own progress!
- Don’t understimate the power of PR interface on Github. Describe your changes, read code, ask questions, ask for corrections before you merge!
You finished working on the feature/branch, and there were no changes to remote master while you worked on it
T — terminal G — github.com
- T
gst# is it green/red? if yes — 2 - T
git add . && git commit -m "describe change in present tense"# e.g.: “change button position” - T
git push origin name-of-your-branch - T
hub browseto go to the GitHub web interface - G You will notice a prompt asking you to create a Pull Request, use the prompt
- G Describe your changes and create Pull Request
⚠️ Don’t merge yourself unless 1000% sure - G Lead programmer closes your PR (merges your changes to remote master). But you’re not done yet!
- T
git co master# to get back to master - T
git pull origin master# to update your local master with remote changes - T
git sweep# to delete the branch you’re done with - T
git co -b my-new-feature# because life is hard and you never stop working
You are not done working and you need changes from remote master to go on
- T
gst# is it green/red? if yes — 2 - T
git add . && git commit -m "an explanatory description in present tense" - T
git co master# to change to master - T
git pull origin masterto get the master with all latest changes - T
git co your-current-branch-nameto switch back to your branch - T
git merge masterto merge remote changes to your current branch⚠️ ⚠️ ⚠️ ACHTUNG! Conflicts!!! - Relax 😌
- Resolve conflicts by going to all conflicted files and keeping just one good version of code (talk to other people here!). You may want to run
rails db:migratein your merging branch too (if you have a conflict in a schema). - T
git add . && git commit -m "resolve conflicts" - Continue your work in a current branch until done.
When done: Follow the best-case scenario.