threads / discuss / 23625

Groups of commits

Subject: Groups of commits

## tl;dr

6 messages between Apr 28, 2010 and Apr 28, 2010.

replies: 5people: 6as markdown or json

John Tapsell· Apr 28, 2010, 01:59 UTC · lore
Hi all,
  In my work place, we have a lot of strict rules to get something
committed.  The code has to pass against a large test suite, it has to
be tested on different hardware, and so on.
  The problem is that it forces everyone to have one single large
commit for a week's work.  All the intermediate stages get squashed
and that history forever lost.
  It would be nice to have a commit in the repository, treated as a
single commit for all purposes, but then be able to split it into
multiple commits if necessary.
  Any ideas?
John
Jeff King· Apr 28, 2010, 02:14 UTC · re: John Tapsell · lore

Re: Groups of commits

On Wed, Apr 28, 2010 at 10:59:44AM +0900, John Tapsell wrote:
Show 7 quoted lines
>   In my work place, we have a lot of strict rules to get something
> committed.  The code has to pass against a large test suite, it has to
> be tested on different hardware, and so on.
> 
>   The problem is that it forces everyone to have one single large
> commit for a week's work.  All the intermediate stages get squashed
> and that history forever lost.

Redefine "committed" to be "merged to the mainline branch" (or "committed to the mainline branch" if you need to keep the nomenclature to please pointy-haired people). Have everybody work on their own branch each week (or better yet, a branch per topic).

When they would make their single big commit, instead "git merge --no-ff" from the topic branch into mainline. Do your tests on the result. If it fails, kick back an error (or whatever you do now). If it works, then add that merge commit to mainline.

If you want to see the "big commits", follow "log --first-parent" of the mainline branch. These commits will all pass the test suite. If you want to see the whole history, then use regular history browsing. Commits on side-branches do not necessarily pass the test suite.

>   It would be nice to have a commit in the repository, treated as a
> single commit for all purposes, but then be able to split it into
> multiple commits if necessary.

My suggestion above is not exactly what you asked for. It treats the history as multiple commits most of the time, but using --first-parent you can ask for just the big commits.

-Peff
Michael Poole· Apr 28, 2010, 02:15 UTC · re: John Tapsell · lore

Re: Groups of commits

John Tapsell writes:
Show 15 quoted lines
> Hi all,
>
>   In my work place, we have a lot of strict rules to get something
> committed.  The code has to pass against a large test suite, it has to
> be tested on different hardware, and so on.
>
>   The problem is that it forces everyone to have one single large
> commit for a week's work.  All the intermediate stages get squashed
> and that history forever lost.
>
>   It would be nice to have a commit in the repository, treated as a
> single commit for all purposes, but then be able to split it into
> multiple commits if necessary.
>
>   Any ideas?

Isn't that what topic branches are for? When development is done on a short-lived branch (hopefully one with a descriptive name), the only commit that needs to go through that process is the merge onto the integration branch.

Michael Poole
Tay Ray Chuan· Apr 28, 2010, 05:25 UTC · re: Michael Poole · lore

Re: Groups of commits

On Wed, Apr 28, 2010 at 10:15 AM, Michael Poole <mdpoole@troilus.org> wrote:
Show 22 quoted lines
> John Tapsell writes:
>
>> Hi all,
>>
>>   In my work place, we have a lot of strict rules to get something
>> committed.  The code has to pass against a large test suite, it has to
>> be tested on different hardware, and so on.
>>
>>   The problem is that it forces everyone to have one single large
>> commit for a week's work.  All the intermediate stages get squashed
>> and that history forever lost.
>>
>>   It would be nice to have a commit in the repository, treated as a
>> single commit for all purposes, but then be able to split it into
>> multiple commits if necessary.
>>
>>   Any ideas?
>
> Isn't that what topic branches are for?  When development is done on a
> short-lived branch (hopefully one with a descriptive name), the only
> commit that needs to go through that process is the merge onto the
> integration branch.

Just to add to the "merge in topic branches" idea - if you find that the commits are trivially fast-forwardable, you can still add a short note/cover letter with

  git merge --no-ff -m "Added in foo's work" <branch/commit>
-- 
Cheers,
Ray Chuan
Alex Riesen· Apr 28, 2010, 08:05 UTC · re: Tay Ray Chuan · lore

Re: Groups of commits

On Wed, Apr 28, 2010 at 07:25, Tay Ray Chuan <rctay89@gmail.com> wrote:
Show 6 quoted lines
> Just to add to the "merge in topic branches" idea - if you find that
> the commits are trivially fast-forwardable, you can still add a short
> note/cover letter with
>
>  git merge --no-ff -m "Added in foo's work" <branch/commit>
>

Except that is not a "short note" anymore, but a full-fledged merge commit. You forced it with "--no-ff".

Avery Pennarun· Apr 28, 2010, 12:46 UTC · re: Alex Riesen · lore

Re: Groups of commits

On Wed, Apr 28, 2010 at 4:05 AM, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 9 quoted lines
> On Wed, Apr 28, 2010 at 07:25, Tay Ray Chuan <rctay89@gmail.com> wrote:
>> Just to add to the "merge in topic branches" idea - if you find that
>> the commits are trivially fast-forwardable, you can still add a short
>> note/cover letter with
>>
>>  git merge --no-ff -m "Added in foo's work" <branch/commit>
>
> Except that is not a "short note" anymore, but a full-fledged merge
> commit. You forced it with "--no-ff".

I think it's safe to say that a commit *is* just a "short note" about a tree, who made it, the reason (message), and who its parents were.

Have fun,
Avery

← back to recent threads