[Plone-conference] A tip about working with git at sprints

Maurits van Rees m.van.rees at zestsoftware.nl
Sat Oct 13 23:40:21 UTC 2012


Op 14-10-12 01:29, David Glick schreef:
> In thanks for your gittips, here is a "git tip" for you:
> When we have sprints and lots of people are working on the same 
> package at once, the git commit log tends to get cluttered with lots 
> of merge commits that look like "Merge branch 'master' into 
> ploneconf2012". This happens because while you were making your 
> commit, someone else already pushed a new one to github, so when you 
> pull git makes a new commit to merge the two changes.
>
> Instead of doing "git pull," you can do "git pull --rebase". This will 
> make git redo your commit(s) after the one(s) that happened on github, 
> so that no additional merge commit is necessary unless something 
> conflicts.

Ah, I have not used that one yet.  Should work nicely, thanks.  I 
usually do interactive rebases.

In case you have already done a normal git pull and you have ended up in 
the situation David mentions, you can also do `git rebase -i HEAD^^` to 
interactively rebase the last two commits (or more, if you add more 
carets).  If you have not done this before, you may want to first make a 
quick copy or tarball of your clone, just to be safe.

If this scares you (it should not), then ask a fellow sprinter to assist 
you.  It should not take long.

If it still scares you, simply do what you have done until now: do a git 
pull and push your changes without worrying about all this. Getting your 
fixes committed and pushed upstream is more important than how the 
commit message looks.  But: it is a worthwhile skill to have.


-- 
Maurits van Rees: http://maurits.vanrees.org/
Zest Software: http://zestsoftware.nl



More information about the Plone-conference mailing list