Keeping a clean history and smooth git workflow comes down to knowing the base use-cases & rules.
Rebases are how changes should pass from the top of hierarchy downwards and merges are how they flow back upwards.
- Use
git pull --rebase
when pulling changes from origin. - Use
git merge
when merging feature branch changes back to master.
Rebasing Deletes Merge Commits! Never rebase master onto your feature branch!
see also
Using
see also
–preserve-merges
flag.
Using
merge
when pulling changes from origin ties two histories together creating interleaved messy thread of histories:- Interleaved history during
merge
: their feature X, my feature Y, their feature X, my feature Y... - Linear history during
rebase
: their feature X, their feature X, my feature Y, my feature Y...
No comments:
Post a Comment