{"thread":{"id":"15835","subject":"keeping remote branches in sync","startedAt":"2008-10-09T14:14:18Z","lastAt":"2008-10-09T15:46:37Z","messageCount":5,"participants":["Kevin Green","Peter Harris","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"92673","messageId":"20081009141418.GF18241@morganstanley.com","threadId":"15835","inReplyTo":null,"subject":"keeping remote branches in sync","fromName":"Kevin Green","fromEmail":"kevin.t.green@morganstanley.com","sentAt":"2008-10-09T14:14:18Z","receivedAt":"2008-10-09T14:14:18Z","isPatch":false,"sender":{"key":"kevin.t.green@morganstanley.com","avatar":null},"body":"\nHi,\n\nWe've been using git for our development for a few months now.  We've got two\ndevelopers and each push up to a shared bare repository.  Our workflow is pretty\nsimple and goes something like this:\n\nWe do development in local topic branches.  Occasionally, when we want the\nother to take a look we might push them up to our shared repo.\n\nOnce we're happy with local testing and code review, we rename the topic\nbranch to prefix it with \"$user/for_next/\".  This lets us know that the developer\nfeels the code is ready for more further integration testing.  We use a branch\ncalled 'next' which merges all the for_next branches together.  One of us\nmerges all the for_next branches locally and pushes it up to the shared repo.\nWe then have some jobs that release that branch as an alpha nightly build for\nfurther testing by more users.\n\nAfter topic branches are merged to master, we do some cleanup by deleting them\nfrom the shared repo.\n\nOne of the issues we have is that _my_ local repos remote branches aren't kept\nin sync with the shared repo.  So, if the other developer deletes all his\ntopic branches and I do a git-pull, the topic branches still show as remotes\nin my branch and vice versa for him.  This is exactly what we expect, but it's\nnot desirable for us.\n\nI'd like some comment on whether our workflow could use some improvement.\nSpecifically, if there's a straightforward way to handle the issue above, that\nwould be great.  I've been looking through the manual on git-fetch and\ngit-pull and not seeing any options to do this. \n\nI was thinking of writing a little utility that does a 'git-cherry master $topic'\nand doing a 'git-branch -d -r $topic' on any topic branch that is already in master, \nbut I'd rather use something already there, if possible.\n\nWhat are others doing to handle this situation?\n\n\nThanks!\n\n\n--Kevin\n"},{"id":"92674","messageId":"eaa105840810090743pba41a98ocdf79b7c06d76e9e@mail.gmail.com","threadId":"15835","inReplyTo":"20081009141418.GF18241@morganstanley.com","subject":"Re: keeping remote branches in sync","fromName":"Peter Harris","fromEmail":"git@peter.is-a-geek.org","sentAt":"2008-10-09T14:43:21Z","receivedAt":"2008-10-09T14:43:21Z","isPatch":false,"sender":{"key":"git@peter.is-a-geek.org","avatar":null},"body":"On Thu, Oct 9, 2008 at 10:14 AM, Kevin Green wrote:\n> After topic branches are merged to master, we do some cleanup by deleting them\n> from the shared repo.\n>\n> One of the issues we have is that _my_ local repos remote branches aren't kept\n> in sync with the shared repo.\n...\n\n> I'd like some comment on whether our workflow could use some improvement.\n> Specifically, if there's a straightforward way to handle the issue above, that\n> would be great.  I've been looking through the manual on git-fetch and\n> git-pull and not seeing any options to do this.\n\nIs \"git remote prune\" what you're looking for?\n\nPeter Harris\n"},{"id":"92679","messageId":"20081009151636.GT8203@spearce.org","threadId":"15835","inReplyTo":"eaa105840810090743pba41a98ocdf79b7c06d76e9e@mail.gmail.com","subject":"Re: keeping remote branches in sync","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-09T15:16:36Z","receivedAt":"2008-10-09T15:16:36Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Peter Harris <git@peter.is-a-geek.org> wrote:\n> On Thu, Oct 9, 2008 at 10:14 AM, Kevin Green wrote:\n> > After topic branches are merged to master, we do some cleanup by deleting them\n> > from the shared repo.\n> >\n> > One of the issues we have is that _my_ local repos remote branches aren't kept\n> > in sync with the shared repo.\n> ...\n> \n> > I'd like some comment on whether our workflow could use some improvement.\n> > Specifically, if there's a straightforward way to handle the issue above, that\n> > would be great.  I've been looking through the manual on git-fetch and\n> > git-pull and not seeing any options to do this.\n> \n> Is \"git remote prune\" what you're looking for?\n\nI keep meaning to add \"git remote prune\" logic into \"git fetch\",\ne.g. as a \"git fetch --prune\" option.  fetch has all of the data\nit needs to implement the prune already in memory, it just doesn't\nhave the loop to do the prune cleanup.\n\nNow that \"git remote\" is in C it should be easy to share the prune\ncode between them, and make this more automatic.\n\n-- \nShawn.\n"},{"id":"92683","messageId":"20081009153738.GJ18241@morganstanley.com","threadId":"15835","inReplyTo":"20081009151636.GT8203@spearce.org","subject":"Re: keeping remote branches in sync","fromName":"Kevin Green","fromEmail":"kevin.t.green@morganstanley.com","sentAt":"2008-10-09T15:37:39Z","receivedAt":"2008-10-09T15:37:39Z","isPatch":false,"sender":{"key":"kevin.t.green@morganstanley.com","avatar":null},"body":"On 10/09/08 11:16:36, Shawn O. Pearce wrote:\n> Peter Harris <git@peter.is-a-geek.org> wrote:\n> > On Thu, Oct 9, 2008 at 10:14 AM, Kevin Green wrote:\n> > > After topic branches are merged to master, we do some cleanup by deleting them\n> > > from the shared repo.\n> > >\n> > > One of the issues we have is that _my_ local repos remote branches aren't kept\n> > > in sync with the shared repo.\n> > ...\n> > \n> > > I'd like some comment on whether our workflow could use some improvement.\n> > > Specifically, if there's a straightforward way to handle the issue above, that\n> > > would be great.  I've been looking through the manual on git-fetch and\n> > > git-pull and not seeing any options to do this.\n> > \n> > Is \"git remote prune\" what you're looking for?\n> \n\nYes, it seems to be exactly what we want, though we'd want it just done\ninstead of having to run it ourselves... :)\n\n> I keep meaning to add \"git remote prune\" logic into \"git fetch\",\n> e.g. as a \"git fetch --prune\" option.  fetch has all of the data\n> it needs to implement the prune already in memory, it just doesn't\n> have the loop to do the prune cleanup.\n> \n> Now that \"git remote\" is in C it should be easy to share the prune\n> code between them, and make this more automatic.\n\nThat would be great...  And a config option to have it done by default each\ntime so '$ git-pull' will just do what we want for our origin remote?\n\n\nThanks\n\n--Kevin\n"},{"id":"92682","messageId":"20081009154637.GV8203@spearce.org","threadId":"15835","inReplyTo":"20081009153738.GJ18241@morganstanley.com","subject":"Re: keeping remote branches in sync","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-09T15:46:37Z","receivedAt":"2008-10-09T15:46:37Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Kevin Green <Kevin.T.Green@morganstanley.com> wrote:\n> On 10/09/08 11:16:36, Shawn O. Pearce wrote:\n> > I keep meaning to add \"git remote prune\" logic into \"git fetch\",\n> > e.g. as a \"git fetch --prune\" option.  fetch has all of the data\n> > it needs to implement the prune already in memory, it just doesn't\n> > have the loop to do the prune cleanup.\n> > \n> > Now that \"git remote\" is in C it should be easy to share the prune\n> > code between them, and make this more automatic.\n> \n> That would be great...  And a config option to have it done by default each\n> time so '$ git-pull' will just do what we want for our origin remote?\n\nRight.  I think most users would want to set that config option.\ngit-gui has a config option to enable this prune after fetch\nbehavior, but its basically just calling \"git remote prune\" when\nfetch is done running.\n\nI think can also work around it with an alias:\n\n\tgit config --alias fp \\\n\t'! git fetch \"$0\" \"$@\" && git remote prune \"$0\"'\n\nNot bullet proof but it should do the prune for you after it does\nthe fetch, assuming you fetched from an existing remote and not a\nrandom URL.\n\n-- \nShawn.\n"}]}