Subject: Re: Parallell Development / Switching to GIT

From: David Aguilar <[email-masked]>
Date: Sun, 28 Jun 2009 15:33:20 -0700

On Sun, Jun 28, 2009 at 10:08:45PM +0200, Patrick Neuner - Futureweb.at wrote:
> Hi,
> 
> thanks for your answers, I appreciate that.
> I read about cherry-picking, but I am not quite sure if that's really what we need. 
> Lets assume, you do a new feature: 
> 
> /featureX
> 
> You will commit it, check it out on the testserver and probably see a bug, fix it, commit and push it again. (and probably more commits after the testing person ran over other issues). 

You are doing parallel development with a centralized resource:
the test server.

That is not going to fly, and there's no amount of tooling
that will resolve this conflict.

The only solution is spend some time on infrastructure and
use virtual machines (virtualbox and other systems are known to
work well; I'm sure you can find better recommendations from
others here) to remove your central test server bottleneck.
You don't even need virtual machines.  It sounds like you're
developing a webapp, in which case every normal workstation
would do just fine for hosting a test server.

Once you have the test environment duplicated on each
developers' machine then you will find that testing and
managing new features using "feature branches" will come
easily and naturally.

This exercise will also improve your deployment strategy
substantially.  There is no longer anything particularly
special about $production_server or $test_server.  They would
all be "just another instance" of the easily replicatable
environment that you've created for the development team.

I've intentionally described things at a high level.
There are plenty of good resources that go into the mechanics
of how to use feature branches in git.

Once all of your features and bugfixes are happening on
branches then knowing which commits went into a particular
feature or bugfix becomes trivial.

In summary: use branches.
They are a simple yet very powerful construct.

> With cherry-picking, I would need to know all commits I have to pick. 
> But as there have been serveral commits, so wouldn't it be a pain to check all commits to that file or directory to have the same version?
> 
> Just trying to find the right way to handle that. 
> 
> 
> About the 2nd point - I am not sure if I get the different repositories thing. 
> Do you talk about to different clones of the rep, and give different directory permissions on it, 
> or is there a way to have like to completly different git rep's running and still merge things over (both ways)?
> I just thought this approach would break correct mergin, as it doesn't know where it's comming from. 
> 
> The only thing I ran over so far is probably doing a hook for that (like a pre-pull hook if that exists). didn't get to read too much about hooks yet,
> just did the update hook that checks if the user with specific ssh key is allowed to push to a specific branch. That works pretty good and is more important in fact.
> 
> But having 2 completly different repos would be another solution, but I kinda wonder that mergin would work correctly this way (if both sides have changes). 
> 
> Thanks
> Patrick 
> 
> -----Ursprüngliche Nachricht-----
> Von: Jeff King [mailto:[email-masked]] 
> Gesendet: Sonntag, 28. Juni 2009 20:47
> An: Patrick Neuner - Futureweb.at
> Cc: Andreas Ericsson; [email-masked]
> Betreff: Re: Parallell Development / Switching to GIT
> 
> On Sun, Jun 28, 2009 at 07:51:26PM +0200, Patrick Neuner - Futureweb.at wrote:
> 
> > 1) What if I only want to merge a specific file/directly, but not the
> > whole branch, is there a way?
> > [...]
> > The reason is, that external developers will only commit to
> > development branch.  They are working on new features, and sometimes
> > some small bugfixes, or design templates.  Those need to be merged
> > separately, and we try to not have more branches. As developers can
> > access our testserver and then see what they have done and test
> > functionality.
> 
> For the situation you describe, it is not about merging a specific
> _file_, but rather you want to pick specific _commits_ from the
> development branch that have the bugfixes (or whatever) that you need,
> and merge the changes introduced by those commits (but not the rest of
> the history).
> 
> And that is easy to do; it is called cherry-picking, and you can use
> "git cherry-pick" to pick specific commits from development to master.
> 
> > 2) We are using gitosis to give external developers access to the
> > branches and have some kind of access restriction.  But we are only
> > able to limit push rights, not pull rights. In most cases, that's not
> > a problem, if they see master And development, but sometimes (like for
> > external designers), we might want them to only be able to checkout
> > some directories.
> 
> There are two ways you can split access, and one will work but the other
> will not.
> 
> In git, you generally cannot split your data by _tree_. That is, you
> cannot say "here is all of the history for the master branch, but you
> are only allowed to look at some subset of the files." Because at a
> fundamental level, git is about tracking changes to the _whole_ set of
> files over time, and it makes the assumption that if you have commit X,
> which points to tree Y, which points to files A, B, and C, that you will
> have the data for X, Y, A, B, and C in your repository.
> 
> However, if you have your data split by _history_, that might work. That
> is, if you have a "master" branch and a "development" branch, you can in
> theory say "you may look at the history of master, but not of
> development". The usual way to do that is to actually keep "master" and
> "development" in two different repositories, and only grant read
> permission in the filesystem for the "master" one (which obviously
> implies doing your reading over something authenticated, like ssh).
> 
> Hope that helps,
> -Peff

-- 

	David