In theory that would be nice. In practice though its a whole lot harder. When you get into graphy things like this some assertions are harder than others.
Preventing all merges is relatively easy, just check each commit pushed only has a single parent. To prevent the "merged master to master" you'd have to go through each merge commit and check where its parents led to. Though that gets a bit wonky cause of how branch names are temporary. More like what you'd want is to prevent merges that include one parent that points to a commit already on the other parent. Which is possible, but turns into a graph theory problem of a different nature. Because more like what you want is to prevent certain types of merges in general based on some patterns and that gets difficult enough for academic publication. Not the level of work I want to pursue for a git hook. On Thu, Nov 8, 2012 at 4:44 AM, Robert Newson <[email protected]> wrote: > I wonder if we can loosen the hook script so it allows merge commits > between branches but not within them? The main reason merge commits are > disliked is when, usually by accident, a merge commit happens within a > single branch. That makes for confusing history merely because it was > pushed after someone else had updated the branch. If we all stick to the > rule of working on branches and only merging down when complete, this > shouldn't matter, but a script that prevents accidents would be very handy. > > > On 8 November 2012 07:30, Paul Davis <[email protected]> wrote: > > > Merge commits have two parents. This is currently disabled by the git > hooks > > I wrote. Which affects things like GH PR's being automatically closed > when > > merged to master etc. > > > > The alternative method is to rebase commits to master which changes the > > sha1 which prevents Git from automatically tracking what branches they're > > on. > > > > > > On Wed, Nov 7, 2012 at 9:43 PM, Jan Lehnardt <[email protected]> wrote: > > > > > > > > On Nov 7, 2012, at 15:26 , Robert Newson <[email protected]> > > wrote: > > > > > > > All, > > > > > > > > After 1.3.0, we agreed to work on feature branches and bugfix > branches, > > > and > > > > then merge the results down after review. > > > > > > > > We need a change to the git commit hooks to allow merge commits (they > > are > > > > currently prohibited). Can I get some votes pls? > > > > > > Can you explain in two sentences each what the effective differences > are? > > > Just so we have it on record in this thread. > > > > > > Cheers > > > Jan > > > -- > > > > > > > > >
