threads / discuss / 10811

Local branch to remote branch translation

Subject: Local branch to remote branch translation

## tl;dr

10 messages between Nov 11, 2007 and Nov 12, 2007.

replies: 9people: 2as markdown or json

Jon Smirl· Nov 11, 2007, 17:54 UTC · lore
What am I doing wrong in this sequence?
In my local repo I have two remotes:

jonsmirl@terra:~/mpc5200b$ git remote dreamhost linus

I create branches off from these using: git branch -b m29 linus/master

I update them with stg rebase linus/master

My repo has a .git/packed-refs file
When I push this repo to a remote server my local branches get renamed.
jonsmirl@terra:~/mpc5200b$ git push dreamhost
To ssh://jonsmirl1@git.digispeaker.com/~/mpc5200b.git
 * [new branch]      m24 -> linus/m24
 * [new branch]      m25 -> linus/m25
 * [new branch]      m26 -> linus/m26
 * [new branch]      m28 -> linus/m28
 * [new branch]      m29 -> linus/m29
Counting objects: 619084, done.
...
So one the remote server I see this:
[daedalus]$ git remote
[daedalus]$ git branch
[daedalus]$ git branch -r
  linus/m24
  linus/m25
  linus/m26
  linus/m28
  linus/m29
[daedalus]$

With the repo in this state at the remote server gitweb thinks the repo is empty. Why are these branches getting renamed?

git head is in use on both ends.
-- 
Jon Smirl
jonsmirl@gmail.com
Jon Smirl· Nov 11, 2007, 18:02 UTC · re: Jon Smirl · lore

Re: Local branch to remote branch translation

Is the remote config not correct?
[remote "dreamhost"]
        url = ssh://jonsmirl1@git.digispeaker.com/~/mpc5200b.git
        fetch = +refs/heads/*:refs/remotes/dreamhost/*
        push = +refs/heads/*:refs/remotes/linus/*
-- 
Jon Smirl
jonsmirl@gmail.com
Steffen Prohaska· Nov 11, 2007, 18:19 UTC · re: Jon Smirl · lore

Re: Local branch to remote branch translation

On Nov 11, 2007, at 7:02 PM, Jon Smirl wrote:
> Is the remote config not correct?

This is the configuration for remote "dreamhost". In your previous mail you also mentioned a remote "linus". But this seems to be unrelated to your question.

> [remote "dreamhost"]
>         url = ssh://jonsmirl1@git.digispeaker.com/~/mpc5200b.git
>         fetch = +refs/heads/*:refs/remotes/dreamhost/*

correct. This fetches the branches from the remote and stores them locally as remote tracking branches "dreamhost/<branch>".

>         push = +refs/heads/*:refs/remotes/linus/*

This "renames" your branches when you push. Your local branches get pushed to "dreamhost" and are stored there as remote branches "linus/<branch>". From your previous mail I assume you like to store them as normal branches. You'd need to say

	push = +refs/heads/*:refs/heads/*

But most likely you don't want to force here, that is drop '+'. And you don't need to explicitly say that you want to store a branch under the same name. So, probably you want

	push = refs/heads/*

But maybe you could even drop the push line completely. Then, only existing branches would be pushed and if you want to create a new remote branch on "dreamhost" you'd need to explicitly tell git with

	git push dreamhost <new-branch>
Does this help?
	
	Steffen
Jon Smirl· Nov 11, 2007, 19:36 UTC · re: Steffen Prohaska · lore

Re: Local branch to remote branch translation

On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
Show 23 quoted lines
>
> On Nov 11, 2007, at 7:02 PM, Jon Smirl wrote:
>
> > Is the remote config not correct?
>
> This is the configuration for remote "dreamhost". In your
> previous mail you also mentioned a remote "linus". But
> this seems to be unrelated to your question.
>
>
> > [remote "dreamhost"]
> >         url = ssh://jonsmirl1@git.digispeaker.com/~/mpc5200b.git
> >         fetch = +refs/heads/*:refs/remotes/dreamhost/*
>
> correct. This fetches the branches from the remote and stores
> them locally as remote tracking branches "dreamhost/<branch>".
>
> >         push = +refs/heads/*:refs/remotes/linus/*
>
> This "renames" your branches when you push. Your local branches
> get pushed to "dreamhost" and are stored there as remote branches
> "linus/<branch>". From your previous mail I assume you like to store
> them as normal branches. You'd need to say

I did this part incorrectly. I was trying to push my local definition of the linus remote to the dreamhost repo so that when someone clones dreamhost linus would be defined in their repo.

jonsmirl@terra:~/mpc5200b$ git remote show linus
* remote linus
  URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
How do I push the definition of the linus remote repo?
Show 19 quoted lines
>
>         push = +refs/heads/*:refs/heads/*
>
> But most likely you don't want to force here, that is drop '+'.
> And you don't need to explicitly say that you want to store a branch
> under the same name. So, probably you want
>
>         push = refs/heads/*
>
> But maybe you could even drop the push line completely. Then, only
> existing branches would be pushed and if you want to create a new
> remote branch on "dreamhost" you'd need to explicitly tell git with
>
>         git push dreamhost <new-branch>
>
> Does this help?
>
>         Steffen
>
-- 
Jon Smirl
jonsmirl@gmail.com
Steffen Prohaska· Nov 11, 2007, 20:59 UTC · re: Jon Smirl · lore

Re: Local branch to remote branch translation

On Nov 11, 2007, at 8:36 PM, Jon Smirl wrote:
Show 35 quoted lines
> On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
>>
>> On Nov 11, 2007, at 7:02 PM, Jon Smirl wrote:
>>
>>> Is the remote config not correct?
>>
>> This is the configuration for remote "dreamhost". In your
>> previous mail you also mentioned a remote "linus". But
>> this seems to be unrelated to your question.
>>
>>
>>> [remote "dreamhost"]
>>>         url = ssh://jonsmirl1@git.digispeaker.com/~/mpc5200b.git
>>>         fetch = +refs/heads/*:refs/remotes/dreamhost/*
>>
>> correct. This fetches the branches from the remote and stores
>> them locally as remote tracking branches "dreamhost/<branch>".
>>
>>>         push = +refs/heads/*:refs/remotes/linus/*
>>
>> This "renames" your branches when you push. Your local branches
>> get pushed to "dreamhost" and are stored there as remote branches
>> "linus/<branch>". From your previous mail I assume you like to store
>> them as normal branches. You'd need to say
>
> I did this part incorrectly. I was trying to push my local definition
> of the linus remote to the dreamhost repo so that when someone clones
> dreamhost linus would be defined in their repo.
>
> jonsmirl@terra:~/mpc5200b$ git remote show linus
> * remote linus
>   URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/ 
> linux-2.6.git
>
> How do I push the definition of the linus remote repo?

You can't. Remotes are local to a repository. They cannot be "pushed" nor will they be "cloned" or "fetched".

	Steffen
Jon Smirl· Nov 11, 2007, 21:20 UTC · re: Steffen Prohaska · lore

Re: Local branch to remote branch translation

On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
Show 9 quoted lines
> > jonsmirl@terra:~/mpc5200b$ git remote show linus
> > * remote linus
> >   URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
> > linux-2.6.git
> >
> > How do I push the definition of the linus remote repo?
>
> You can't. Remotes are local to a repository. They cannot be
> "pushed" nor will they be "cloned" or "fetched".

Dreamhost is way slow compared to kernel.org, so it is better to clone from kernel.org first and then pull from dreamhost. What is the right sequence of commands so that a new user will end up with a kernel they can use 'git pull' on to get updates from dreamhost? I'll add these to the repo description page.

I'm trying this locally and I can't figure out the right sequence of git command to redirect origin from kernel.org to dreamhost.

Doing this was bad, it messed up my heads. jonsmirl@terra:~/foo/digispeaker$ git remote rm origin error: unable to resolve reference refs/remotes/origin/master: No such file or directory update-ref -d refs/remotes/origin/master 6e800af233e0bdf108efb7bd23c11ea6fa34cdeb: command returned error: 1

-- 
Jon Smirl
jonsmirl@gmail.com
Steffen Prohaska· Nov 11, 2007, 22:01 UTC · re: Jon Smirl · lore

Re: Local branch to remote branch translation

On Nov 11, 2007, at 10:20 PM, Jon Smirl wrote:
Show 19 quoted lines
> On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
>>> jonsmirl@terra:~/mpc5200b$ git remote show linus
>>> * remote linus
>>>   URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
>>> linux-2.6.git
>>>
>>> How do I push the definition of the linus remote repo?
>>
>> You can't. Remotes are local to a repository. They cannot be
>> "pushed" nor will they be "cloned" or "fetched".
>
> Dreamhost is way slow compared to kernel.org, so it is better to clone
> from kernel.org first and then pull from dreamhost. What is the right
> sequence of commands so that a new user will end up with a kernel they
> can use 'git pull' on to get updates from dreamhost? I'll add these to
> the repo description page.
>
> I'm trying this locally and I can't figure out the right sequence of
> git command to redirect origin from kernel.org to dreamhost.
How about the following (untested sequence)
	mkdir linux-2.6
	cd linux-2.6
	git init
	git remote add linus git://git.kernel.org/pub/scm/linux/kernel/git/ 
torvalds/linux-2.6.git
	git remote add origin ssh://jonsmirl1@git.digispeaker.com/~/ 
mpc5200b.git
	git fetch linus
	git fetch origin
	git checkout -b master origin/master

The general idea should be correct. You have a non-standard setup, so avoid git-clone.

	Steffen
Jon Smirl· Nov 11, 2007, 22:46 UTC · re: Steffen Prohaska · lore

Re: Local branch to remote branch translation

On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
Show 38 quoted lines
>
> On Nov 11, 2007, at 10:20 PM, Jon Smirl wrote:
>
> > On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
> >>> jonsmirl@terra:~/mpc5200b$ git remote show linus
> >>> * remote linus
> >>>   URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
> >>> linux-2.6.git
> >>>
> >>> How do I push the definition of the linus remote repo?
> >>
> >> You can't. Remotes are local to a repository. They cannot be
> >> "pushed" nor will they be "cloned" or "fetched".
> >
> > Dreamhost is way slow compared to kernel.org, so it is better to clone
> > from kernel.org first and then pull from dreamhost. What is the right
> > sequence of commands so that a new user will end up with a kernel they
> > can use 'git pull' on to get updates from dreamhost? I'll add these to
> > the repo description page.
> >
> > I'm trying this locally and I can't figure out the right sequence of
> > git command to redirect origin from kernel.org to dreamhost.
>
> How about the following (untested sequence)
>
>         mkdir linux-2.6
>         cd linux-2.6
>         git init
>         git remote add linus git://git.kernel.org/pub/scm/linux/kernel/git/
> torvalds/linux-2.6.git
>         git remote add origin ssh://jonsmirl1@git.digispeaker.com/~/
> mpc5200b.git
>         git fetch linus
>         git fetch origin
>         git checkout -b master origin/master
>
> The general idea should be correct. You have a non-standard
> setup, so avoid git-clone.

What should I do to standardize the setup so that 'clone/pull' will work on it? I created a master branch. I gave up on fighting with gitweb and no branch named master.

I'd like to do this, but I can't figure out how.

git clone linus move origin to digispeaker git pull

There doesn't seem to be a simple way to redirect the origin.
-- 
Jon Smirl
jonsmirl@gmail.com
Steffen Prohaska· Nov 12, 2007, 06:25 UTC · re: Jon Smirl · lore

Re: Local branch to remote branch translation

On Nov 11, 2007, at 11:46 PM, Jon Smirl wrote:
Show 47 quoted lines
> On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
>>
>> On Nov 11, 2007, at 10:20 PM, Jon Smirl wrote:
>>
>>> On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
>>>>> jonsmirl@terra:~/mpc5200b$ git remote show linus
>>>>> * remote linus
>>>>>   URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
>>>>> linux-2.6.git
>>>>>
>>>>> How do I push the definition of the linus remote repo?
>>>>
>>>> You can't. Remotes are local to a repository. They cannot be
>>>> "pushed" nor will they be "cloned" or "fetched".
>>>
>>> Dreamhost is way slow compared to kernel.org, so it is better to  
>>> clone
>>> from kernel.org first and then pull from dreamhost. What is the  
>>> right
>>> sequence of commands so that a new user will end up with a kernel  
>>> they
>>> can use 'git pull' on to get updates from dreamhost? I'll add  
>>> these to
>>> the repo description page.
>>>
>>> I'm trying this locally and I can't figure out the right sequence of
>>> git command to redirect origin from kernel.org to dreamhost.
>>
>> How about the following (untested sequence)
>>
>>         mkdir linux-2.6
>>         cd linux-2.6
>>         git init
>>         git remote add linus git://git.kernel.org/pub/scm/linux/ 
>> kernel/git/
>> torvalds/linux-2.6.git
>>         git remote add origin ssh://jonsmirl1@git.digispeaker.com/~/
>> mpc5200b.git
>>         git fetch linus
>>         git fetch origin
>>         git checkout -b master origin/master
>>
>> The general idea should be correct. You have a non-standard
>> setup, so avoid git-clone.
>
> What should I do to standardize the setup so that 'clone/pull' will
> work on it?

Pull should work after you checked out origin/master. Pull should fetch from origin and merge to local master.

But I don't see a way how you could use clone for your setup.
> I created a master branch. I gave up on fighting with
> gitweb and no branch named master.
I don't understand your comment about gitweb.
Show 7 quoted lines
> I'd like to do this, but I can't figure out how.
>
> git clone linus
> move origin to digispeaker
> git pull
>
> There doesn't seem to be a simple way to redirect the origin.
I don't know a simple way.
	Steffen
Jon Smirl· Nov 12, 2007, 13:53 UTC · re: Steffen Prohaska · lore

Re: Local branch to remote branch translation

On 11/12/07, Steffen Prohaska <prohaska@zib.de> wrote:
Show 61 quoted lines
>
> On Nov 11, 2007, at 11:46 PM, Jon Smirl wrote:
>
> > On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
> >>
> >> On Nov 11, 2007, at 10:20 PM, Jon Smirl wrote:
> >>
> >>> On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
> >>>>> jonsmirl@terra:~/mpc5200b$ git remote show linus
> >>>>> * remote linus
> >>>>>   URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
> >>>>> linux-2.6.git
> >>>>>
> >>>>> How do I push the definition of the linus remote repo?
> >>>>
> >>>> You can't. Remotes are local to a repository. They cannot be
> >>>> "pushed" nor will they be "cloned" or "fetched".
> >>>
> >>> Dreamhost is way slow compared to kernel.org, so it is better to
> >>> clone
> >>> from kernel.org first and then pull from dreamhost. What is the
> >>> right
> >>> sequence of commands so that a new user will end up with a kernel
> >>> they
> >>> can use 'git pull' on to get updates from dreamhost? I'll add
> >>> these to
> >>> the repo description page.
> >>>
> >>> I'm trying this locally and I can't figure out the right sequence of
> >>> git command to redirect origin from kernel.org to dreamhost.
> >>
> >> How about the following (untested sequence)
> >>
> >>         mkdir linux-2.6
> >>         cd linux-2.6
> >>         git init
> >>         git remote add linus git://git.kernel.org/pub/scm/linux/
> >> kernel/git/
> >> torvalds/linux-2.6.git
> >>         git remote add origin ssh://jonsmirl1@git.digispeaker.com/~/
> >> mpc5200b.git
> >>         git fetch linus
> >>         git fetch origin
> >>         git checkout -b master origin/master
> >>
> >> The general idea should be correct. You have a non-standard
> >> setup, so avoid git-clone.
> >
> > What should I do to standardize the setup so that 'clone/pull' will
> > work on it?
>
> Pull should work after you checked out origin/master. Pull should
> fetch from origin and merge to local master.
>
> But I don't see a way how you could use clone for your setup.
>
>
> > I created a master branch. I gave up on fighting with
> > gitweb and no branch named master.
>
> I don't understand your comment about gitweb.

At http://git.digispeaker.com/ The short log, log, tree links won't work unless master exists. Once master is there, everything works.

Show 16 quoted lines
>
>
> > I'd like to do this, but I can't figure out how.
> >
> > git clone linus
> > move origin to digispeaker
> > git pull
> >
> > There doesn't seem to be a simple way to redirect the origin.
>
> I don't know a simple way.
>
>         Steffen
>
>
>
-- 
Jon Smirl
jonsmirl@gmail.com

← back to recent threads