git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* easy way to make tracking branches?
@ 2009-01-18 10:55 Stephan Beyer
  2009-01-18 15:37 ` Sitaram Chamarty
  0 siblings, 1 reply; 3+ messages in thread
From: Stephan Beyer @ 2009-01-18 10:55 UTC (permalink / raw)
  To: git

Hi,

assume I have a branch "foo" in my local repo, a remote "srv", and
a branch "bar" on srv (i.e. generated with "git push srv foo:bar").

Now I want to make "foo" a tracking branch for "bar".
I do:

	git config branch.foo.remote srv
	git config branch.foo.merge refs/heads/bar

And to get a comfortable git-push, I do:

	git config --add remote.srv.push foo:bar


Because I do not always remember the sequence, I have to look it
up or I just do

	git checkout -b foo2 srv/bar
	git branch -d foo
	git branch -m foo

which is suboptimal because deleting foo can remove some
other settings for the branch, e.g. mergeoptions.


So I wonder if there is some easier-to-remind way to let my branch
foo track my remote branch bar, or, if not, could it be useful to
have something like

	git push --make-tracking srv foo:bar
	# push foo -> bar and let foo track bar...
	# if foo already tracks bar, ignore the option

or should I just write a tiny script for me and shut up? :-)


Regards,
  Stephan

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

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

* Re: easy way to make tracking branches?
  2009-01-18 10:55 easy way to make tracking branches? Stephan Beyer
@ 2009-01-18 15:37 ` Sitaram Chamarty
  2009-01-18 15:53   ` Stephan Beyer
  0 siblings, 1 reply; 3+ messages in thread
From: Sitaram Chamarty @ 2009-01-18 15:37 UTC (permalink / raw)
  To: git

On 2009-01-18, Stephan Beyer <s-beyer@gmx.net> wrote:
> Now I want to make "foo" a tracking branch for "bar".
> I do:
>
> 	git config branch.foo.remote srv
> 	git config branch.foo.merge refs/heads/bar

I just do a "git pull srv" when the tracking is *not* setup,
and git reminds me what commands to use.

> And to get a comfortable git-push, I do:
>
> 	git config --add remote.srv.push foo:bar

This one you'll just have to remember, I guess :-)

> 	git checkout -b foo2 srv/bar
> 	git branch -d foo
> 	git branch -m foo
>
> which is suboptimal because deleting foo can remove some
> other settings for the branch, e.g. mergeoptions.

it also doesn't seem to set remote.srv.push, as far as I can
tell.

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

* Re: easy way to make tracking branches?
  2009-01-18 15:37 ` Sitaram Chamarty
@ 2009-01-18 15:53   ` Stephan Beyer
  0 siblings, 0 replies; 3+ messages in thread
From: Stephan Beyer @ 2009-01-18 15:53 UTC (permalink / raw)
  To: Sitaram Chamarty; +Cc: git

Hi,

Sitaram Chamarty wrote:
> > Now I want to make "foo" a tracking branch for "bar".
> > I do:
> >
> > 	git config branch.foo.remote srv
> > 	git config branch.foo.merge refs/heads/bar
> 
> I just do a "git pull srv" when the tracking is *not* setup,
> and git reminds me what commands to use.

Oh, this is great! (Just tested.)

Usually (in my use case) there is no need to pull before I set up
a tracking branch, so I never tried this.

And git only reminds you if you have no tracking branch set for
srv yet. But that's no problem, because if one is set I can
copy&paste the lines in .git/config.

Altogether, this is a solution I can live with.

> > And to get a comfortable git-push, I do:
> >
> > 	git config --add remote.srv.push foo:bar
> 
> This one you'll just have to remember, I guess :-)

This is not too hard. :-)

> > 	git checkout -b foo2 srv/bar
> > 	git branch -d foo
> > 	git branch -m foo
> >
> > which is suboptimal because deleting foo can remove some
> > other settings for the branch, e.g. mergeoptions.
> 
> it also doesn't seem to set remote.srv.push, as far as I can
> tell.

Right.


Thanks,
  Stephan

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

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

end of thread, other threads:[~2009-01-18 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-18 10:55 easy way to make tracking branches? Stephan Beyer
2009-01-18 15:37 ` Sitaram Chamarty
2009-01-18 15:53   ` Stephan Beyer

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).