git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: how to reduce disk usage for large .git dirs?

From
Fredrik Gustafsson <iveqy@iveqy.com>
Date
Nov 13, 2014, 16:03 UTC
Message-ID
<20141113160325.GA24351@paksenarrion.iveqy.com>
In-Reply-To
<20141113154457.GA31624@aepfle.de>
Thanks for sharing your notes! A few comments:
On Thu, Nov 13, 2014 at 04:44:57PM +0100, Olaf Hering wrote:
Show 18 quoted lines
> 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.

Show 8 quoted lines
> To publish the outstanding changes its required to do this from the master
> repo. First checkout the work branch, then pull the local changes and finally
> push them to the remote repo.
> # cd repo-master
> # git checkout branchA
> # git pull
> # git push origin branchA
> # cd -

It's not. You could just add your remote repository as a remote to each of your clones of your master repo and push directly from them. It would be much simplier and it would allow you to directly fetch changes from your remote into your branches as well.

(however, I'm not sure but I think, that this will slowly increase the difference between your repositories when you develop. So that they won't change any new data since to local clone was made).

-- 
Med vänlig hälsning
Fredrik Gustafsson

tel: 0733-608274
e-post: iveqy@iveqy.com
Previous: Olaf HeringNext: Johan Herland
Message 9 of 18 in “how to reduce disk usage for large .git dirs?”
  1. Olaf HeringNov 13, 2014
  2. Fredrik GustafssonNov 13, 2014
  3. Olaf HeringNov 13, 2014
  4. Jakub NarębskiNov 14, 2014
  5. Roger GammansNov 13, 2014
  6. Olaf HeringNov 13, 2014
  7. Duy NguyenNov 13, 2014
  8. Olaf HeringNov 13, 2014
  9. Fredrik GustafssonNov 13, 2014
  10. Johan HerlandNov 13, 2014
  11. Jeff KingNov 13, 2014
  12. Olaf HeringNov 14, 2014
  13. Fredrik GustafssonNov 14, 2014
  14. Olaf HeringNov 14, 2014
  15. Olaf HeringNov 14, 2014
  16. Olaf HeringNov 14, 2014
  17. Andreas SchwabNov 14, 2014
  18. Olaf HeringNov 25, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.