Hi Thomas,
yes its me again;) I just have few things.

The way you deleting branches works, but it only remove tracking of 
branches not their commits ( git branch -D unwanted-branch-A ) but i needed 
to remove their commit as well. What is well made in article you sent me 
before ->  
<- answer from Jakub 
And i use your reaaly good point about
git submodule add ../masteronly-bare.git submoduleX 

and i just change it to (what is propably similiar, but its just poiting on 
my needs, that i want still need to have connection with my original 
submodule source for each clone of my Project with submodule submoduleX)
git submodule add http://original-source.com/submoduleX.git submoduleX

And now i have some Project with added submodule in state i wanted (without 
any other commits, than commits which belongs to master branch) -> THAT IS 

BUT (there is always some), when i decide to clone Project i get newProject 
is again submodule with all commits (not only master branch specific).

So it is nice to have what i absolutely need on localhost, but if I want go 
live with my project(clone on live server), i lost this ability, and I am 
again on start. 

Any suggestions? All of this is corrupting (going around) decentralized 
version controll system, but only for this small "weakness" which is huge 
.git repo when it is using more branches with lot of commits ..

Be Well, Ondra.

On Tuesday, 17 July 2012 16:53:34 UTC+2, Thomas Ferris Nicolaisen wrote:
> On Monday, July 16, 2012 4:32:59 PM UTC+2, Nedvajz wrote:
>> 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 
>> branches.
>> 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!
> Sounds pretty straight forward: Set up a bare repository that tracks only 
> one branch like in the link described, and then link it in as a submodule, 
> the same way you would do with any submodule:
> git clone original masteronly-bare.git
> cd masteronly-bare.git
> git branch -D unwanted-branch-A
> git branch -D unwanted-branch-B
> git gc --prune=now  #removes the now unreferenced commits
> Now, go into your other repo where you want the submodule with the single 
> branch:
> cd ../super-repo
> git submodule add ../masteronly-bare.git submoduleX
> Now you can push changes in the submodule back to the branchless-bare.git:
> cd submoduleX
> git checkout master
> echo foo >> work.txt
> git commit -am "Working in master"
> git push origin master
> And when you want to sync the changes back to the original repo with all 
> the branches, pull from the branchless-bare:
> cd ../../original/
> git remote add bb ../masteronly-bare.git
> git checkout master
> git pull bb master
> Recap: Only your *original* repo is now aware of all the branches. In the 
> super-repo, as well as in the masteronly-bare, there is no knowledge of the 
> "secret" branches, but you can still pull commits in master back to the 
> original via the masteronly-bare repository.

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 git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to