Re: how to reduce disk usage for large .git dirs?
flat view
From: Olaf Hering <hidden>
Date: 2016-06-15 23:02:56
On Thu, Nov 13, Fredrik Gustafsson wrote:
Thanks for sharing your notes! A few comments: On Thu, Nov 13, 2014 at 04:44:57PM +0100, Olaf Hering wrote:quoted
First clone the remote repository as usual. Then create a local branch for each remote branch that is supposed to be worked on: # git clone git://host/repo.git repo-master # cd repo-master # git checkout -b branchA origin/branchA # git checkout -b branchB origin/branchB # cd - Now clone each work branch into its own directory. The work dir references the master repo. All changes come from and go into this repo, instead of the remote repo. # git clone -l -b branchA repo-master repo-branchA # git clone -l -b branchB repo-master repo-branchB To make changs in a work dir, commit as usual. The changes will be pushed from the work copy into the local master repo. Its required to have some other branch than branchA active in repo-master, or push from work copy to repo-master will fail.That's one of the reason it's not recommended to push into a non-bare repository. You should clone your repo-master with the --bare option to avoid having a work dir there.
So my repo-master is now "bare". I pushed from repo-branchA into repo-master and see my commits in both repos. But pushing from repo-master to the remote fails because repo-master does not have outstanding remote commits. However, git fetch doesnt do anything: Fetching origin From host:/remote/dir * branch HEAD -> FETCH_HEAD Obviously I miss something. The man page of git clone or fetch does not mention how "bare" is supposed to be handled. Olaf