How can I access remote branches in a cloned repository on my local machine?

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

How can I access remote branches in a cloned repository on my local machine?

From: Erich Ocean <hidden>
Date: 2016-06-15 22:43:43

Our developer group has a shared git repository at git@git. 
1kstudios.lan:dev.

Each developer has established their own local repository by running:

	git clone git@git.1kstudios.lan:dev
	git config remote.origin.push master:refs/remotes/<username>/master

Each developer then does a `git pull` to update their master branch,  
merges their changes from their local topic branches, and then does  
`git push` to make the results available at git@git.1kstudios.lan:dev.

As the integrator, I have then been ssh'ing into the git@git. 
1kstudios.lan machine, cd'ing to "dev" and doing:

	git merge <username>/master

to incorporate their changes after running `git diff` to see what the  
changes are.

My own development repository is set up identically to the other  
developers.

What I would like to do now is clone the git@git.1kstudios.lan:dev  
repository on my local machine a second time, checkout a <username>/ 
master branch in that repository, and then use BBEdit's graphical  
diff to visually see the changes between my own repository and what  
another developer has pushed to the shared repository. I'll then  
merge them into my own developer repository and push that to the  
shared repository for the rest of the developers to pull from, so no  
longer will I merge by ssh'ing into the machine with the shared  
repository.

The problem is, when I clone git@git.1kstudios.lan:dev, the various  
<username>/master's aren't there. I have tried a bunch of different  
ways, but they all give me errors. For example:

 > logan-2:~ ocean$ git clone git@git.1kstudios.lan:dev commiters
 > Initialized empty Git repository in /Users/ocean/commiters/.git/
 > git@git.1kstudios.lan's password:
 > remote: Generating pack...
 > remote: Done counting 7029 objects.
 > remote: Deltifying 7029 objects...
 > remote:  100% (7029/7029) done
 > Indexing 7029 objects...
 > remote: Total 7029 (delta 3334), reused 2456 (delta 1154)
 >  100% (7029/7029) done
 > Resolving 3334 deltas...
 >  100% (3334/3334) done
 > Checking 3864 files out...
 >  100% (3864/3864) done
 > logan-2:~ ocean$ cd commiters
 > logan-2:~/commiters ocean$ git branch
 > * masterlogan-2:~/commiters ocean$ git checkout -b jchumley/master  
jchumley
 > git checkout: updating paths is incompatible with switching  
branches/forcing

How can I access remote branches in a cloned repository on my local  
machine?

Thanks!

Erich

Re: How can I access remote branches in a cloned repository on my local machine?

From: Julian Phillips <hidden>
Date: 2016-06-15 22:43:43

On Sat, 20 Oct 2007, Erich Ocean wrote:
Our developer group has a shared git repository at git@git.1kstudios.lan:dev.

Each developer has established their own local repository by running:

	 git clone git@git.1kstudios.lan:dev
	 git config remote.origin.push master:refs/remotes/<username>/master

Each developer then does a `git pull` to update their master branch, merges 
their changes from their local topic branches, and then does `git push` to 
make the results available at git@git.1kstudios.lan:dev.

As the integrator, I have then been ssh'ing into the git@git.1kstudios.lan 
machine, cd'ing to "dev" and doing:

	git merge <username>/master

to incorporate their changes after running `git diff` to see what the changes 
are.

My own development repository is set up identically to the other developers.

What I would like to do now is clone the git@git.1kstudios.lan:dev repository 
on my local machine a second time, checkout a <username>/master branch in 
that repository, and then use BBEdit's graphical diff to visually see the 
changes between my own repository and what another developer has pushed to 
the shared repository. I'll then merge them into my own developer repository 
and push that to the shared repository for the rest of the developers to pull 
from, so no longer will I merge by ssh'ing into the machine with the shared 
repository.

The problem is, when I clone git@git.1kstudios.lan:dev, the various 
<username>/master's aren't there. I have tried a bunch of different ways, but 
they all give me errors. For example:
The default fetch refspec doesn't include the remotes - after all, you 
normally don't want the origin for your origin ...
How can I access remote branches in a cloned repository on my local machine?
Try something like:

git config remote.origin.fetch +refs/remotes/*:+refs/remotes/*
git fetch

-- 
Julian

  ---
No matter how cynical you get, it's impossible to keep up.

Re: How can I access remote branches in a cloned repository on my local machine?

From: Julian Phillips <hidden>
Date: 2016-06-15 22:43:43

On Sat, 20 Oct 2007, Julian Phillips wrote:
quoted
 The problem is, when I clone git@git.1kstudios.lan:dev, the various
 <username>/master's aren't there. I have tried a bunch of different ways,
 but they all give me errors. For example:
The default fetch refspec doesn't include the remotes - after all, you 
normally don't want the origin for your origin ...
quoted
 How can I access remote branches in a cloned repository on my local
 machine?
Try something like:

git config remote.origin.fetch +refs/remotes/*:+refs/remotes/*
sorry, that should have been:
git config remote.origin.fetch +refs/remotes/*:refs/remotes/*
git fetch
-- 
Julian

  ---
"The National Association of Theater Concessionaires reported that in
1986, 60% of all candy sold in movie theaters was sold to Roger Ebert."
 		-- D. Letterman

Re: How can I access remote branches in a cloned repository on my local machine?

From: Jan Hudec <hidden>
Date: 2016-06-15 22:43:43

On Sat, Oct 20, 2007 at 06:15:21 -0700, Erich Ocean wrote:
Our developer group has a shared git repository at 
git@git.1kstudios.lan:dev.

Each developer has established their own local repository by running:

	git clone git@git.1kstudios.lan:dev
	git config remote.origin.push master:refs/remotes/<username>/master
The paths on server are refs/remotes/<userame>/master.

It's more common to publish (push to public or shared repository) to
refs/heads. The refs/remotes namespace is normally only used when fetching.
There's nothing in git saying you can't do it your way, but there are things
that make the common way more convenient.
Each developer then does a `git pull` to update their master branch, merges 
their changes from their local topic branches, and then does `git push` to 
make the results available at git@git.1kstudios.lan:dev.

As the integrator, I have then been ssh'ing into the git@git.1kstudios.lan 
machine, cd'ing to "dev" and doing:

	git merge <username>/master
Yes, because locally refs/remotes is searched when looking for unqualified
ref. But if you checked that out, git would complain it's not a branch and
created a detached head.
to incorporate their changes after running `git diff` to see what the 
changes are.

My own development repository is set up identically to the other 
developers.

What I would like to do now is clone the git@git.1kstudios.lan:dev 
repository on my local machine a second time, checkout a <username>/master 
branch in that repository, and then use BBEdit's graphical diff to visually 
see the changes between my own repository and what another developer has 
pushed to the shared repository. I'll then merge them into my own developer 
repository and push that to the shared repository for the rest of the 
developers to pull from, so no longer will I merge by ssh'ing into the 
machine with the shared repository.

The problem is, when I clone git@git.1kstudios.lan:dev, the various 
<username>/master's aren't there. I have tried a bunch of different ways, 
but they all give me errors. For example:
By default clone only compies refs from refs/heads to refs/remotes/origin and
from refs/tags to refs/tags.

You have two options here:
 - Move the branches on server to refs/heads. Then the various
   <username>/master will be visible locally as origin/<username>/master
   (qualified names refs/remotes/origin/<username>/master -- you can of
   course call the remote differently if you want).
 - Add +refs/remotes/*:refs/remotes/origin/* to remote.origin.fetch config
   key in your local repository (I am not sure it will work properly with
   multiple source patterns with the same destination pattern, though).

-- 
						 Jan 'Bulb' Hudec [off-list ref]

[Solved] How can I access remote branches in a cloned repository on my local machine?

From: Erich Ocean <hidden>
Date: 2016-06-15 22:43:43

Per Julian Phillips' suggestion:

 > logan-2:~ ocean$ cd commiters/
 > logan-2:~/commiters ocean$ git config remote.origin.fetch +refs/ 
remotes/*:refs/remotes/*
 > logan-2:~/commiters ocean$ git fetch
 > git@git.1kstudios.lan's password:
 > * refs/remotes/eocean/master: storing remote branch 'eocean/ 
master' of git@git.1kstudios.lan:dev
 >   commit: 06b4b2e
 > * refs/remotes/gt/master: storing remote branch 'gt/master' of  
git@git.1kstudios.lan:dev
 >   commit: 889a585
 > * refs/remotes/jchumley/master: storing remote branch 'jchumley/ 
master' of git@git.1kstudios.lan:dev
 >   commit: 18cead3
 > logan-2:~/commiters ocean$ git branch
 >   +refs/remotes/eocean/master
 >   +refs/remotes/gt/master
 >   +refs/remotes/jchumley/master
 > * master
 > logan-2:~/commiters ocean$ git checkout  +refs/remotes/jchumley/ 
master
 > Switched to branch "+refs/remotes/jchumley/master"

Best, Erich

On Oct 20, 2007, at 6:56 AM, Julian Phillips wrote:
On Sat, 20 Oct 2007, Julian Phillips wrote:
quoted
quoted
 The problem is, when I clone git@git.1kstudios.lan:dev, the various
 <username>/master's aren't there. I have tried a bunch of  
different ways,
 but they all give me errors. For example:
The default fetch refspec doesn't include the remotes - after all,  
you normally don't want the origin for your origin ...
quoted
 How can I access remote branches in a cloned repository on my local
 machine?
Try something like:

git config remote.origin.fetch +refs/remotes/*:+refs/remotes/*
sorry, that should have been:
git config remote.origin.fetch +refs/remotes/*:refs/remotes/*
quoted
git fetch
-- 
Julian

 ---
"The National Association of Theater Concessionaires reported that in
1986, 60% of all candy sold in movie theaters was sold to Roger  
Ebert."
		-- D. Letterman
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help