git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* keeping remote branches in sync
@ 2008-10-09 14:14 Kevin Green
  2008-10-09 14:43 ` Peter Harris
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Green @ 2008-10-09 14:14 UTC (permalink / raw)
  To: git


Hi,

We've been using git for our development for a few months now.  We've got two
developers and each push up to a shared bare repository.  Our workflow is pretty
simple and goes something like this:

We do development in local topic branches.  Occasionally, when we want the
other to take a look we might push them up to our shared repo.

Once we're happy with local testing and code review, we rename the topic
branch to prefix it with "$user/for_next/".  This lets us know that the developer
feels the code is ready for more further integration testing.  We use a branch
called 'next' which merges all the for_next branches together.  One of us
merges all the for_next branches locally and pushes it up to the shared repo.
We then have some jobs that release that branch as an alpha nightly build for
further testing by more users.

After topic branches are merged to master, we do some cleanup by deleting them
from the shared repo.

One of the issues we have is that _my_ local repos remote branches aren't kept
in sync with the shared repo.  So, if the other developer deletes all his
topic branches and I do a git-pull, the topic branches still show as remotes
in my branch and vice versa for him.  This is exactly what we expect, but it's
not desirable for us.

I'd like some comment on whether our workflow could use some improvement.
Specifically, if there's a straightforward way to handle the issue above, that
would be great.  I've been looking through the manual on git-fetch and
git-pull and not seeing any options to do this. 

I was thinking of writing a little utility that does a 'git-cherry master $topic'
and doing a 'git-branch -d -r $topic' on any topic branch that is already in master, 
but I'd rather use something already there, if possible.

What are others doing to handle this situation?


Thanks!


--Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: keeping remote branches in sync
  2008-10-09 14:14 keeping remote branches in sync Kevin Green
@ 2008-10-09 14:43 ` Peter Harris
  2008-10-09 15:16   ` Shawn O. Pearce
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Harris @ 2008-10-09 14:43 UTC (permalink / raw)
  To: git

On Thu, Oct 9, 2008 at 10:14 AM, Kevin Green wrote:
> After topic branches are merged to master, we do some cleanup by deleting them
> from the shared repo.
>
> One of the issues we have is that _my_ local repos remote branches aren't kept
> in sync with the shared repo.
...

> I'd like some comment on whether our workflow could use some improvement.
> Specifically, if there's a straightforward way to handle the issue above, that
> would be great.  I've been looking through the manual on git-fetch and
> git-pull and not seeing any options to do this.

Is "git remote prune" what you're looking for?

Peter Harris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: keeping remote branches in sync
  2008-10-09 14:43 ` Peter Harris
@ 2008-10-09 15:16   ` Shawn O. Pearce
  2008-10-09 15:37     ` Kevin Green
  0 siblings, 1 reply; 5+ messages in thread
From: Shawn O. Pearce @ 2008-10-09 15:16 UTC (permalink / raw)
  To: Peter Harris; +Cc: git

Peter Harris <git@peter.is-a-geek.org> wrote:
> On Thu, Oct 9, 2008 at 10:14 AM, Kevin Green wrote:
> > After topic branches are merged to master, we do some cleanup by deleting them
> > from the shared repo.
> >
> > One of the issues we have is that _my_ local repos remote branches aren't kept
> > in sync with the shared repo.
> ...
> 
> > I'd like some comment on whether our workflow could use some improvement.
> > Specifically, if there's a straightforward way to handle the issue above, that
> > would be great.  I've been looking through the manual on git-fetch and
> > git-pull and not seeing any options to do this.
> 
> Is "git remote prune" what you're looking for?

I keep meaning to add "git remote prune" logic into "git fetch",
e.g. as a "git fetch --prune" option.  fetch has all of the data
it needs to implement the prune already in memory, it just doesn't
have the loop to do the prune cleanup.

Now that "git remote" is in C it should be easy to share the prune
code between them, and make this more automatic.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: keeping remote branches in sync
  2008-10-09 15:16   ` Shawn O. Pearce
@ 2008-10-09 15:37     ` Kevin Green
  2008-10-09 15:46       ` Shawn O. Pearce
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Green @ 2008-10-09 15:37 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Peter Harris, git

On 10/09/08 11:16:36, Shawn O. Pearce wrote:
> Peter Harris <git@peter.is-a-geek.org> wrote:
> > On Thu, Oct 9, 2008 at 10:14 AM, Kevin Green wrote:
> > > After topic branches are merged to master, we do some cleanup by deleting them
> > > from the shared repo.
> > >
> > > One of the issues we have is that _my_ local repos remote branches aren't kept
> > > in sync with the shared repo.
> > ...
> > 
> > > I'd like some comment on whether our workflow could use some improvement.
> > > Specifically, if there's a straightforward way to handle the issue above, that
> > > would be great.  I've been looking through the manual on git-fetch and
> > > git-pull and not seeing any options to do this.
> > 
> > Is "git remote prune" what you're looking for?
> 

Yes, it seems to be exactly what we want, though we'd want it just done
instead of having to run it ourselves... :)

> I keep meaning to add "git remote prune" logic into "git fetch",
> e.g. as a "git fetch --prune" option.  fetch has all of the data
> it needs to implement the prune already in memory, it just doesn't
> have the loop to do the prune cleanup.
> 
> Now that "git remote" is in C it should be easy to share the prune
> code between them, and make this more automatic.

That would be great...  And a config option to have it done by default each
time so '$ git-pull' will just do what we want for our origin remote?


Thanks

--Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: keeping remote branches in sync
  2008-10-09 15:37     ` Kevin Green
@ 2008-10-09 15:46       ` Shawn O. Pearce
  0 siblings, 0 replies; 5+ messages in thread
From: Shawn O. Pearce @ 2008-10-09 15:46 UTC (permalink / raw)
  To: Kevin Green; +Cc: Peter Harris, git

Kevin Green <Kevin.T.Green@morganstanley.com> wrote:
> On 10/09/08 11:16:36, Shawn O. Pearce wrote:
> > I keep meaning to add "git remote prune" logic into "git fetch",
> > e.g. as a "git fetch --prune" option.  fetch has all of the data
> > it needs to implement the prune already in memory, it just doesn't
> > have the loop to do the prune cleanup.
> > 
> > Now that "git remote" is in C it should be easy to share the prune
> > code between them, and make this more automatic.
> 
> That would be great...  And a config option to have it done by default each
> time so '$ git-pull' will just do what we want for our origin remote?

Right.  I think most users would want to set that config option.
git-gui has a config option to enable this prune after fetch
behavior, but its basically just calling "git remote prune" when
fetch is done running.

I think can also work around it with an alias:

	git config --alias fp \
	'! git fetch "$0" "$@" && git remote prune "$0"'

Not bullet proof but it should do the prune for you after it does
the fetch, assuming you fetched from an existing remote and not a
random URL.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-09 15:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-09 14:14 keeping remote branches in sync Kevin Green
2008-10-09 14:43 ` Peter Harris
2008-10-09 15:16   ` Shawn O. Pearce
2008-10-09 15:37     ` Kevin Green
2008-10-09 15:46       ` Shawn O. Pearce

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 NNTP newsgroup(s).