* fetch for bare repository @ 2012-01-13 10:42 Dmitry A. Ashkadov 2012-01-13 13:40 ` Carlos Martín Nieto 0 siblings, 1 reply; 4+ messages in thread From: Dmitry A. Ashkadov @ 2012-01-13 10:42 UTC (permalink / raw) To: git Hello! I can't understand how to fetch branches from external repository for bare repository. For example, imagine 2 git repositories: "B" and "C". "B" repository is external repository and it contains branch "branch1". "C" is an internal repository (special repository for some people). "C" repository may be created with command: > $ git clone --bare B . For "C" repository working set isn't required, so it may be bare, I think. This new "C" repository contains branch "branch1". Imagine that somebody has created a new branch "branch2" in the repository "B". I don't know what I should do with repository "C" to make the branch "branch2" available on repository "C". Command: > $ git fetch origin doesn't work. Next command for repository "C": > $ git branch -a always shows only branch "branch1" but never branch "branch2". Could you help me, please? Thank you! ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fetch for bare repository 2012-01-13 10:42 fetch for bare repository Dmitry A. Ashkadov @ 2012-01-13 13:40 ` Carlos Martín Nieto 2012-01-13 13:54 ` Dmitry A. Ashkadov 0 siblings, 1 reply; 4+ messages in thread From: Carlos Martín Nieto @ 2012-01-13 13:40 UTC (permalink / raw) To: Dmitry A. Ashkadov; +Cc: git [-- Attachment #1: Type: text/plain, Size: 941 bytes --] On Fri, Jan 13, 2012 at 02:42:03PM +0400, Dmitry A. Ashkadov wrote: > Hello! > > I can't understand how to fetch branches from external repository > for bare repository. What you probably want is a mirror (git clone --mirror). Unless you tell git that you want a mirror, it's going to assume that you want a bare repo to push your own changes up to it. Such a repo has no need to be kept up to date, so clone doesn't set up any fetch refspecs. Stepping back, do you need to fetch those branches into the private repo? If you still have access to the main repo and that's where the main project development is happening, why not use upstream's repo to get those changes to your local repo (as in the one you use to work)? It sounds like you're trying to replicate a centralised VCS' workflow. Git works like a network and you can merge a branch from upstream if you need to and then push to the private repo. cmn [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 490 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fetch for bare repository 2012-01-13 13:40 ` Carlos Martín Nieto @ 2012-01-13 13:54 ` Dmitry A. Ashkadov 2012-01-13 15:18 ` Carlos Martín Nieto 0 siblings, 1 reply; 4+ messages in thread From: Dmitry A. Ashkadov @ 2012-01-13 13:54 UTC (permalink / raw) To: Carlos Martín Nieto, git 13.01.2012 17:40, Carlos Martín Nieto пишет: > On Fri, Jan 13, 2012 at 02:42:03PM +0400, Dmitry A. Ashkadov wrote: >> Hello! >> >> I can't understand how to fetch branches from external repository >> for bare repository. > What you probably want is a mirror (git clone --mirror). Unless you > tell git that you want a mirror, it's going to assume that you want a > bare repo to push your own changes up to it. Such a repo has no need > to be kept up to date, so clone doesn't set up any fetch refspecs. I don't have access to an origin repository. So, I need bare repository and push changes up to it. So, I think the word "mirror" isn't applicable to private repository. > Stepping back, do you need to fetch those branches into the private > repo? If you still have access to the main repo and that's where the > main project development is happening, why not use upstream's repo to > get those changes to your local repo (as in the one you use to work)? > It sounds like you're trying to replicate a centralised VCS' > workflow. Git works like a network and you can merge a branch from > upstream if you need to and then push to the private repo. Yes, I can add one more remote to my local repository, then fetch changes from it and push it to private repository. But I thought that update private repository is the best way. Thank you! ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fetch for bare repository 2012-01-13 13:54 ` Dmitry A. Ashkadov @ 2012-01-13 15:18 ` Carlos Martín Nieto 0 siblings, 0 replies; 4+ messages in thread From: Carlos Martín Nieto @ 2012-01-13 15:18 UTC (permalink / raw) To: Dmitry A. Ashkadov; +Cc: git [-- Attachment #1: Type: text/plain, Size: 2363 bytes --] On Fri, Jan 13, 2012 at 05:54:31PM +0400, Dmitry A. Ashkadov wrote: > 13.01.2012 17:40, Carlos Martín Nieto пишет: > >On Fri, Jan 13, 2012 at 02:42:03PM +0400, Dmitry A. Ashkadov wrote: > >>Hello! > >> > >>I can't understand how to fetch branches from external repository > >>for bare repository. > >What you probably want is a mirror (git clone --mirror). Unless you > >tell git that you want a mirror, it's going to assume that you want a > >bare repo to push your own changes up to it. Such a repo has no need > >to be kept up to date, so clone doesn't set up any fetch refspecs. > > I don't have access to an origin repository. So, I need bare > repository and push changes up to it. So, I think the word "mirror" > isn't applicable to private repository. When you say access here, do you mean that you can't push to it? When I say access later on, it means being able to fetch from it. Otherwise I don't see how you could have cloned from it. If your private repository's braches to reflect what's upstream, I'd call that a mirror. > > >Stepping back, do you need to fetch those branches into the private > >repo? If you still have access to the main repo and that's where the > >main project development is happening, why not use upstream's repo to > >get those changes to your local repo (as in the one you use to work)? > >It sounds like you're trying to replicate a centralised VCS' > >workflow. Git works like a network and you can merge a branch from > >upstream if you need to and then push to the private repo. > > Yes, I can add one more remote to my local repository, then fetch > changes from it and push it to private repository. But I thought > that update private repository is the best way. Best way to achieve what? If you want your private repo to reflect what's upstream, doing the inital clone with --mirror (or setting the remote.origin.fetch config variable to "+refs/*:refs/*", which is the main difference) will let you run 'git fetch' on that repo and get the changes. But what I was asking was whether you actually need to bother with that operation. If you need to merge or rebase from upstream, a push will include those new changes, as they're now in your branch, so what advantage do you get from copying those branches from upstream if they're just the same? cmn [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 490 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-13 15:18 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-01-13 10:42 fetch for bare repository Dmitry A. Ashkadov 2012-01-13 13:40 ` Carlos Martín Nieto 2012-01-13 13:54 ` Dmitry A. Ashkadov 2012-01-13 15:18 ` Carlos Martín Nieto
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).