threads / discuss / 2444

tracking a tree that doesn't progress linearly

Subject: tracking a tree that doesn't progress linearly

## tl;dr

4 messages between Nov 11, 2005 and Nov 11, 2005.

replies: 3people: 4as markdown or json

Paul Mackerras· Nov 11, 2005, 03:18 UTC · lore

I want to be able to publish a git tree for others to follow but I also want to be retain the freedom to remove commits and/or rebase commits in the tree. For example, if someone sends me a patch and I put it in the tree, then they send me a revised version, I want to be able to roll back to just before I applied the older patch and start again from there.

What this means, AFAICS, is that the head of the published tree won't always be a descendent of all previous values of the head. If somebody is following the state of the tree by doing a git pull every so often, and I have rolled back the tree and applied some new patches, then the git pull will try to merge the old and new state, which is not what we want. What we want is something that just gets the local tree to the same state as the remote tree.

Is there a git command which does the equivalent of a git fetch, followed by setting the head and checking it out?

Or is this an incredibly stupid idea for some reason that hasn't occurred to me yet? :)

Thanks, Paul.

Martin Langhoff· Nov 11, 2005, 04:58 UTC · re: Paul Mackerras · lore

Re: tracking a tree that doesn't progress linearly

On 11/11/05, Paul Mackerras <paulus@samba.org> wrote:
> I want to be able to publish a git tree for others to follow but I
> also want to be retain the freedom to remove commits and/or rebase
> commits in the tree.

I sometimes want that too, but git doesn't have a 'rewind' semantics, and probably for a good reason. The approach I am studying is to create a thousand throaway short-lived branches. It is safe to publish them as long as people following your branches _know_ that they'll be orphaned, and that any commits they have on top of them they'll have to rebase.

So you could publish your tree with devel-<datestamp> heads, and announce when you're moving to a newer one. People tracking your branches can tend register & checkout the new branches, and do a git-merge to rebase their patches to your new branch, or replay them with git-format-patch and git-am.

On the other hand, if StGIT grows better support for sharing patches, it could make all this look like the stone age.

cheers,
martin
Catalin Marinas· Nov 11, 2005, 10:40 UTC · re: Paul Mackerras · lore

Re: tracking a tree that doesn't progress linearly

Paul Mackerras <paulus@samba.org> wrote:
Show 6 quoted lines
> I want to be able to publish a git tree for others to follow but I
> also want to be retain the freedom to remove commits and/or rebase
> commits in the tree.  For example, if someone sends me a patch and I
> put it in the tree, then they send me a revised version, I want to be
> able to roll back to just before I applied the older patch and start
> again from there.

I'm facing a similar problem. I use StGIT for my development branch (usually with less than 20 patches) but I would like to export a HEAD for others to pull from. When rebasing the patches with StGIT, the new HEAD wouldn't be a descendant of the old one.

The partial solution I got to was to make the master branch available to people and the devel branch private. Initially, the master branch would pick the patches ('stg pick') from the devel branch which I want to make public. When I'm happy with the patches on the master branch, I run 'stg commit' and store them permanently (you won't be able to modify them). After permanently storing the patches, I can use the master branch in the normal way with GIT (merge, pull, push etc.).

When I get a patch in the devel branch updated, I just run 'stg pick patchname@devel' in the master branch. Because of the nature of the three-way merge, the new picked patch should only contain the differences from the previous one. It might also cause conflicts which need resolving if the new patch modifies lines which were present in the old patch (i.e. not only additions or removals). At this point you can change the patch description since the new picked patch only represents an update to the old one and not the full feature.

The only little drawback I see with this approach is that merging in the latest changes from the mainline kernel could produce identical conflicts (if any) in both master and devel branches.

-- 
Catalin
Petr Baudis· Nov 11, 2005, 11:06 UTC · re: Paul Mackerras · lore

Re: tracking a tree that doesn't progress linearly

Dear diary, on Fri, Nov 11, 2005 at 04:18:31AM CET, I got a letter where Paul Mackerras <paulus@samba.org> said that...

Show 17 quoted lines
> I want to be able to publish a git tree for others to follow but I
> also want to be retain the freedom to remove commits and/or rebase
> commits in the tree.  For example, if someone sends me a patch and I
> put it in the tree, then they send me a revised version, I want to be
> able to roll back to just before I applied the older patch and start
> again from there.
> 
> What this means, AFAICS, is that the head of the published tree won't
> always be a descendent of all previous values of the head.  If
> somebody is following the state of the tree by doing a git pull every
> so often, and I have rolled back the tree and applied some new
> patches, then the git pull will try to merge the old and new state,
> which is not what we want.  What we want is something that just gets
> the local tree to the same state as the remote tree.
> 
> Is there a git command which does the equivalent of a git fetch,
> followed by setting the head and checking it out?
I plan to change the fast-forward condition in Cogito from
	is_ancestor(current, new_head)
to
	current == old_head || is_ancestor(current, new_head)

which should enable you to do this - just rebase, and it will Just Work for those cg-update'ing from you; the only problem si that cg-fetch + cg-merge will NOT work, but I have no simple workaround for that.

I already proposed this several times and it was always passed in silence, so I assume there are no problems with this approach.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.

← back to recent threads