git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Igor Djordjevic <igor.d.djordjevic@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Nikolay Shustov <nikolay.shustov@gmail.com>
Cc: Stefan Beller <sbeller@google.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: "groups of files" in Git?
Date: Fri, 14 Jul 2017 00:39:25 +0200	[thread overview]
Message-ID: <27a3c650-5843-d446-1f59-64fabe5434a3@gmail.com> (raw)
In-Reply-To: <xmqqzic8t4oi.fsf@gitster.mtv.corp.google.com>

On 13/07/2017 23:20, Junio C Hamano wrote:
> Nikolay Shustov <nikolay.shustov@gmail.com> writes:
>> My question was about how to robustly handle "multiple pending
>> commits" which in Perforce are represented by concept of pending
>> changelists.
> 
> And in Git, they are represented by concept of commits that are not
> yet pushed out to the public repository to become the final history
> carved in stone.

If I may, I don`t think "multiple pending commits" is the issue here 
(as that is indeed what a private branch is), but more something like 
"multiple branches pending/live merge branch", or something.

To illustrate, let`s say this is our starting position:

(1)      o---o---o (featureA)
        /         \
    ---o---o---o---M (master, HEAD)
        \         /
         o---o---o (featureB)


We`re currently on commit "M", being a merge commit between our 
"master" and two feature branches.

Now, what seems lacking, while still possible through a series of 
steps, is an easy (single step) way to modify current state and 
commit the change to the _feature branch_, while still being on the 
"master" branch, still having everything merged in.

So after I make a "featureA" related change while on "M", to be able 
to issue a single command, for example:
 
    $ git commit --branch=featureA

... or:
 
    $ git commit -b featureA 
 
..., where "featureA" would need to be one of the parents of the 
current commit we are at (commit "M", in our case), and get a 
situation like this:

(2)      o---o---o---A (featureA)
        /             \
    ---o---o---o-------M' (master, HEAD)
        \             /
         o---o---o---/ (featureB)


Here, "A" is a new commit/change I`ve just made (while still being on 
the "master" branch), and it is automatically commited to related 
"featureA" branch, with merge commit "M" now recreated into "M'" to 
hold the new "featureA" commit "A" as well.

I guess it would be a kind of alias to doing:

    $ git checkout featureA
    $ git add ...
    $ git commit
    $ git checkout master
    $ git reset --hard HEAD^
    $ git merge featureA featureB

... or something, where last merge step would need to remember 
previous merge commit "M" parent branches and merge them again to 
produce an updated "M'" merge commit.

In the same manner, it should be possible to drop a commit from the 
feature branch in a single step, for example returning to the state 
as shown in (1), or even "port" it from one branch to the other, like
this (without a need for it to be the last commit, even):

(3)      o---o---o---\ (featureA)
        /             \
    ---o---o---o-------M' (master, HEAD)
        \             /
         o---o---A'--o (featureB)


Something like "rebase on steroids", lol, keeping the HEAD where it 
is, and its merge commit beneath updated.

This indeed seems similar to Mercurial`s patch "queues", except being 
much better as everything is still version controlled at all times, 
no additional tools needed to version control the patches (unless 
that`s already been addressed in Mercurial as well, dunno).
 
And it still seems to be following Git`s "multiple commits per 
feature, single feature per branch" spirit, just allowing for 
easier/faster branch integration testing.

p.s. Even if my short sample might be flawed in one way or the other, 
it should show the essence of the functionality we`re discussing 
here, I think.

Regards,
Buga

  reply	other threads:[~2017-07-13 22:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 15:45 "groups of files" in Git? Nikolay Shustov
2017-07-11 17:18 ` Stefan Beller
2017-07-11 17:47   ` Nikolay Shustov
2017-07-13 18:22   ` Junio C Hamano
2017-07-13 19:47     ` Nikolay Shustov
2017-07-13 21:20       ` Junio C Hamano
2017-07-13 22:39         ` Igor Djordjevic [this message]
2017-07-13 23:32           ` Igor Djordjevic
2017-07-13 23:40             ` Igor Djordjevic
2017-07-11 17:27 ` Randall S. Becker
2017-07-11 17:27 ` Junio C Hamano
2017-07-11 18:10   ` Nikolay Shustov
2017-07-11 18:19     ` Stefan Beller
2017-07-11 18:30       ` Nikolay Shustov
2017-07-11 17:39 ` Lars Schneider
2017-07-11 17:54   ` Nikolay Shustov
2017-07-11 20:20     ` Lars Schneider
2017-07-13 15:21       ` Nikolay Shustov
2017-07-11 22:46   ` Igor Djordjevic
2017-07-13 15:37     ` Nikolay Shustov
2017-07-13 18:09       ` Junio C Hamano
2017-07-13 19:31         ` Nikolay Shustov
2017-07-11 20:09 ` Fredrik Gustafsson
2017-07-11 22:27 ` astian
2017-07-13 17:04   ` Nikolay Shustov
2017-07-13 23:06   ` Igor Djordjevic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27a3c650-5843-d446-1f59-64fabe5434a3@gmail.com \
    --to=igor.d.djordjevic@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nikolay.shustov@gmail.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).