-
Notifications
You must be signed in to change notification settings - Fork 492
Branching and Merging
Alex Grin edited this page Jul 19, 2017
·
19 revisions
Git history is similar to code in that it is written once but it is read dozens of times. Therefore we optimize for readability. It should be clear what happened, by whom, when, and ideally why.
git fetch
git checkout -b new_branch origin/master
This reduces merge conflicts in the future
git fetch
git rebase origin/master
When working locally, do whatever you want. Before sharing, clean up your history into logical commits and write good commit messages for them. Focus on clarity for someone reading this 3 months from now.
git fetch
git rebase -i origin/master
git push -u origin your_branch_name
Tip: make lots of small commits, then squash them into one or several bigger commits before pushing. This helps organize your work, so that logically separate changes can be placed into separate commits without manually splitting an existing commit
git fetch
git rebase origin/master
git checkout master
git pull
git merge --no-ff your_branch_name