Skip to content

How to work with git

bydga edited this page Feb 10, 2014 · 6 revisions

PLEASE,

read this: http://randyfay.com/content/avoiding-git-disasters-gory-story - especially "Disaster 2: Merging Without Understanding"

"Automatic" merge commits form one branch to the SAME branch (usually happenning when doing git pull with some stuff already commited locally) are bad. Please read carefully what git tells you and DO NOT push back when you see something like "merge made by the recursive strategy". This commits make the commit history quite unreadable - as they merge together your and someone's work together. Result is one huge commit of not only your's work and makes it completely impossible to do i.e. codereviews, git-blame or reverting the commit

http://cl.ly/image/2G2S000J2q2f - left screen creates new commit and pushes it, while right one makes new commit too and tries to push it as well. However git denies it and tells you to run pull. So you do it and viola - BAD mergecommit is there. http://cl.ly/image/2N3R3n053L1C. - See, even though there were 3 commits done at all (init, x, c), there is ONE MORE automatically created - containing both changes, from commit x AND c

EASIEST SOLUTION just run git pull origin --rebase instead of just git pull origin.

Clone this wiki locally