The link you posted is almost what i want. 

So this i my last try of explain what i am looking for:

1) I want to *clone* only part of some repository and made new one.
This new repo will have only master branch even if the origin has more 
This new repo will have only commits of the master branch even if the 
origin has more commits of other branches. (the new repo will be smaller in 
size = number of commits).

2) I wont lose ability work with old repo. 
Push/Pull to/from origin master branch.
Making new branches in new repo, and pull them onto origin repo.

3) But till I directly set (somehow) this new git repo. It wont fetch any 
new branches and/or get any commits which doesnt belong to master branch 
from origin repo.

So I make summary. The link you posted allow me work like i want, but it 
works with basic repo. I need this to work *on* *submodules*.

So when I will work with project, and make changes in submodules and then I 
will clone whole project somewhere and run "git submodule update" all 
submodules will fetch only needed branch with its commits only(like it is 
in link, but for *submodule here*)

Thanks for you patience!

On Monday, 16 July 2012 15:27:34 UTC+2, Thomas Ferris Nicolaisen wrote:
> Hi, sorry for not replying any more. I managed to lose track of this 
> thread.
> I'm afraid I still don't quite understand, although I didn't have quite 
> the time to read properly through your explanation.
> There are still a lot of confusing terms in there that don't fit with my 
> typical "Git language", so let me try at another interpretation. 
> As it is often easier to solve a problem by first splitting it into 
> several smaller isolated problems, I'll exclude the fact that you want this 
> in a submodule. A submodule is just a link to a commit in another Git 
> repository in the end, so I'm not sure if that's a relevant factor for this 
> question. We can come back to it later anyhow.
> *You want a repository clone that only has knowledge of a few branches.*
> Does maybe this recipe [1] establish that kind of repository you want? 
> If this does not help you, could you perhaps try saying on a higher level 
> what you are actually trying to achieve without going into concrete Git 
> details? Perhaps someone has a better idea of an approach to suit your 
> needs.
> [1] 
> On Monday, July 16, 2012 11:27:47 AM UTC+2, Nedvajz wrote:
>> Do you understand what i mean? Is there any solution, or not? 
>> Thanks for reply;)
>> On Friday, 29 June 2012 16:13:09 UTC+2, Nedvajz wrote:
>>> Hi,
>>> is there a way, how to pull/clone (somehow) only commits of one, and 
>>> only one branch? 
>>> For example:
>>> 1) Lets say i have 3 branches in one submodule. Master(commits 1,2,3,4) 
>>> , Project1(commits 1,2,3,4,5) , Project2(commits 1,2,3,4,6,7,8).
>>> 2) I am starting with Project3 and wanna to get submodule Master branch 
>>> only -> "git submodule add --only_specific_branch_commits
>>> 3) Now i will look into submodule, and "git branch -v" will show me only 
>>> master, and as well "git branch -vr" show me only origin/master ...
>>> And if i will try to git cherry-pick 5 on Master branch-> where 5 is 
>>> commit of Project1 only, there wont be any entry in history or so -> so it 
>>> fails
>>> Why I am looking for something like this? 
>>> We have cms for making Sites composed from submodules and via sumbodules 
>>> we can easily modificate what cms can/cant. 
>>> But always is there needed to specify one of plugins directly for that 
>>> project and there are changes useless for another projects. 
>>> So we made it till now via specific branch to get exactly what we need. 
>>> But after many and many projects, the repo of the most specified 
>>> plugins(modules) is going to be huge and it is not needed at all to get all 
>>> commits of all projects into new one, but just the clean master branch with 
>>> their commits.
>>> Thanks for any help, Nedvajz. 

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to