Please, oh please, use git pull --rebase (Example)
gitrebaseworkflowversion-controlbest-practices
Abstraction: Git rebase best practices for linear history on personal branches
Key points:
git pull --rebasecreates a linear history by replaying your commits on top of incoming changes instead of creating a merge commit- NEVER rebase a shared branch (one multiple developers push to) — it rewrites history and causes havoc for other contributors
- Safe pattern: always work on a personal feature/fix branch and rebase against the remote shared branch (
origin/shared-branch) - Force push (
-f) is required after rebasing a branch that has already been pushed remotely, since history diverges - For pull requests, force-push after rebasing to update your PR branch; only safe because no one else should push to it
- Rebase does change history — it rearranges commits — despite some misconceptions to the contrary
Connections: Git · Git Rebase · Version Control · Branching Strategy
Source: https://coderwall.com/p/7aymfa