<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 28 Aug 2009, at 11:37, Dave Brotherstone wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5"><font class="Apple-style-span" color="#888888"><br></font>>> Ian Munday wrote:<br> >> Why Git? I'm familiar with CVS and Subversion, but doesn't Git<br> >> essentially provide the same functionality, albeit in a slightly<br> >> different way (local versus centralised repositories)?<br> >></div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">> David Goodwin wrote<br> ><br> > My understanding (I've never really used git) was that it handles<br> > branching and merging a lot better than subversion.<br> ><br> > I believe git can have a single centralised repository.<br> ><br><br></div></div></blockquote><div><br></div><div>Well, it can... but only because you deem one repository "special" / centralised.</div><div>Branching and merging is far easier, faster and more reliable in git. So good, in fact, that I (and many others) branch for any and every feature or bug fix. </div> <div>You may find that for your project it suits you better. </div><div><br></div><div>So you could have a central branch, and one for each client. When you do something central, you can easily merge it into the client branches - you could actually script this too, so one command would merge it into all your client branches. </div> <div><br></div><div>For clients that have more customisation, if you end up doing something for client X that you later decide you want available to everyone, you can "cherry pick" the commit into the central branch. </div> <div><br></div><div>I work with SVN all day, and have done for years, but since working with git, I hate the way svn works. Everything in git is almost instantaneous, you won't be waiting for any merges or "switches" (called a checkout in git). It's also pretty clever at merging things that have diverged. </div> <div><br></div><div>I think doing the same thing in SVN would be perfectly possible, but you're far more likely to get into difficulty, and end up with things not merged. There's also some really neat features that git can do, that SVN just plain can't - stashing and rewriting history spring to mind.</div> <div><br></div><div>A good reference is <a href="http://progit.org">http://progit.org</a>, which is a really good read. I'll stick an example on the end of this so you can see how it might work.</div></div><div><br></div> <div>Hope that helps,</div><div><br></div><div>Dave.</div><div><br></div>An example....<div><br></div><div>> git branch</div><div>* central</div><div> client1</div><div> client2</div><div> client3</div><div><br></div> <div>(So we're currently on the central branch)</div><div><br><div>> git checkout client1</div><div>Switched to branch client1</div><div><br></div><div>> git branch</div><div><div> central</div><div>* client1</div> <div> client2</div><div> client3</div><div><br></div><div>(Now on the client1 branch, we'll edit the langs file)</div><div><br></div></div><div>> edit lang/en_GB.php</div><div>> git commit -a -m "Updated language file"</div> <div><div>[central c8324b] Updated language file</div><div> 1 files changed, 3 insertions(+), 2 deletions(-)</div><div><br></div><div><br></div><div>( Now we'll edit something on the central branch) </div><div><br></div> </div><div>> git checkout central</div><div>> edit src/someCentralFile.php</div><div>> git commit -a -m "Fixed a bug with xxx"</div><div><div>[central b91e7b2] Fixed a bug with xxx</div><div> 1 files changed, 5 insertions(+), 4 deletions(-)</div> <div><br></div><div>( and go back to client1)</div></div><div>> git checkout client1</div><div><br></div><div>(now we'll check what's not been merged already)</div><div>> git branch --no-merged</div><div> central</div> <div> client2</div><div> client3</div><div><br></div><div>> git merge central</div><div>Automatic merge successful</div><div><br></div><div>> git branch --no-merged</div><div> client2</div><div> client3</div><div> <br></div><div>(Now we'll create a new feature for client1)</div><div><br></div><div>> edit src/someExtraFeature.php</div><div>> git commit -a -m "Added a new feature for client1"</div><div><div>[central 944cb1] Added a new feature for client1</div> <div> 1 files changed, 15 insertions(+), 1 deletions(-)</div><div><br></div></div><div>(Now we want that feature in the central branch)</div><div>> git checkout central</div><div>> git cherry-pick 944cb1</div><div>Automatic merge successful</div></div></blockquote><br></div><div>Hi Dave</div><div><br></div><div>Thanks - that's a useful example. I'm especially drawn to the local repository functionality of Git. Being able to work offline would be great for me (a consequence of where I live means I only have a mobile broadband connection at home).</div><div><br></div><div>I'll also look further at the Pro Git site - that appears a very useful resource.</div><div><br></div><div>Does anyone use GitHub? Like most people, I'm very protective of code which I've not open-sourced, so need to be reassured about putting it with someone else. After all, the value of my product is wrapped up in the code base.</div><div><br></div><div>Regards,</div><div><br></div><div>Ian</div><div><br></div></body></html>