git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: StGIT (or guilt) + git-svn?

From
Steven Grimm <koreth@midwinter.com>
Date
Jul 25, 2007, 06:35 UTC
Message-ID
<46A6EF24.4040606@midwinter.com>
In-Reply-To
<20070724234817.GA29700@dervierte>
Steven Walter wrote:
Show 5 quoted lines
> You certainly could do local versioning this way, but it isn't how I
> accomplish the same thing.  I keep another branch on top of my "public"
> svn commits for local stuff.  If I always run git-svn dcommit from the
> public branch, the local changes will stay local.  After committing, I
> just have to rebase the local branch on onto git-svn.

Do you mix your public and private commits on the private branch, then cherry-pick some of them over to the public branch before running dcommit? Or do you have some other workflow?

That was actually my first suggestion to him, but he pointed out (and I had to agree) that that would mean he's always just one mistake away from publishing his local changes. All it takes is getting interrupted for a moment and mistakenly thinking he already switched to the public branch. He wants some less human-error-prone way to tell the system that a particular change and/or a particular file is not intended for publication, and for the system to just honor that without further human intervention.

Actually, one could argue that the above isn't a git-svn issue at all. You could reasonably want the same thing from git-push too (and even from pull, though that'd be trickier.) I guess it'd take the form of marking a commit as local-only, and having the system automatically rebase all the local-only commits on top of the public ones.

Maybe a wrapper than maintains a pair of underlying git branches for each user-visible branch would work. If you have a branch "foo" with some public and some private changes (private ones in lower case here):

A---B---C---D---e---f---g   foo
            ^ foo-public
Now if you commit a new private revision, it's like normal:
A---B---C---D---e---f---g---h   foo
            ^ foo-public
But if you commit a new public revision, we do something like

git commit git checkout foo-public git cherry-pick foo git checkout foo git rebase foo-public

to get
A---B---C---D---H---e---f---g   foo
                ^ foo-public

Then, when it comes time to do the push / dcommit, we always switch to the foo-public branch first. We push / dcommit, then checkout foo and rebase it on foo-public again (since svn dcommit will leave foo-public pointing at a different revision.)

This seems like it should work in the context of git-svn with its mostly-linear history. Not sure if it'd fall flat on its face in the presence of lots of branching and merging.

I also suspect I've more or less just described StGIT and this would be a big waste of time to reinvent from scratch.

-Steve
Previous: Steven WalterNext: Steven Walter
Message 6 of 7 in “StGIT (or guilt) + git-svn?”
  1. Steven GrimmJul 24, 2007
  2. Steven WalterJul 24, 2007
  3. Steven GrimmJul 24, 2007
  4. Josef SipekJul 24, 2007
  5. Steven WalterJul 24, 2007
  6. Steven GrimmJul 25, 2007
  7. Steven WalterJul 25, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.