git repository in my installatin folder grows when updating via git

git repository in my installatin folder grows when updating via git

by Bernhard Weichel -
Number of replies: 7

Hi,

I Initially installed my moodle with git:

git clone --depth=1 -b MOODLE_28_STABLE --single-branch git://git.moodle.org/moodle.git

then I followed the instruction to update via git according to https://docs.moodle.org/29/en/Git_for_Administrators#Updating_your_installation

$ cd /path/to/your/moodle/ $ git pull

But now my .git folder is twice as big as before. It is not yet a big problem but it adds 13 MB to every site backup.

What can I do?

-B



Average of ratings: -
In reply to Bernhard Weichel

Re: git repository in my installatin folder grows when updating via git

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

git gc --aggressive

Average of ratings: Useful (1)
In reply to Gareth J Barnard

Re: git repository in my installatin folder grows when updating via git

by Bernhard Weichel -

thanks. I tried it, and it reduced the size of my .git substantially; Nevertheless, I am not sure if gives all  what I expected. git log still show commits back to 2001. I guess git pull was the problem. I tried it again with git pull --depth 1 but this fails with lots of error messages.

I am still searching a way to update my moodle installation without the need to reinstall or manually copy all plugins. I thought that GIT would be a nice approach since it properly synchronizes the installation files while leaving the untracked files untouched. On the other hand, I would like not to have too many unused files. And I would not downgrade my installation at all. So there is no need for previous versions.
In reply to Bernhard Weichel

Re: git repository in my installatin folder grows when updating via git

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Remove any branches you don't need.  Commits back to 2001 is fine as is a complete history.  You might want to try combining previous commits into one with 'rebase' but could be problematic.

For plugins you could always add them as 'submodules' against the plugin GitHub (etc.) repository and do the same sort of thing as updating Moodle.

Average of ratings: Useful (1)
In reply to Gareth J Barnard

Re: git repository in my installatin folder grows when updating via git

by Stephan Goeldi -

The size of Moodle (V 3.1.2) directory installed from git is 447 MB (255 MB in .git). That's huge!

I already did

git gc --aggressive

and there is only one local branch (git branch -a).

Is there a possibility to reduce the size? I don't need a history in my local git branch.

Otherwise each instance (test instance, live, stage) and all the backups are three times bigger than "normal".

Thanks for any hint

In reply to Bernhard Weichel

Re: git repository in my installatin folder grows when updating via git

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You don't really *need* to back up the Moodle code if it's an issue. You can always download it again. If you've modified it (including adding plugins) then get your own Github account and keep track of your version there. 

In reply to Howard Miller

Re: git repository in my installatin folder grows when updating via git

by Stephan Goeldi -

Yes, I know. But we did backups from VM's in more than one generation. Unnecessary data need more space, more time, more bandwidth ...

I would prefer more "data economisation". With git, the update process is quite easy, but I don't need a history in running moodle instances. As I noticed the big overhead of Git, I was wondering, if there is a solution to reduce data size.

In reply to Stephan Goeldi

Re: git repository in my installatin folder grows when updating via git

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Sorry, but that's just not how git works. You can't exclude older commits, and doing so would change the commit hashes and thus break future git fetch operations in some fashion.

I'd recommend improving your backup process if at all possible. As was mentioned before, you ideally only need to back up your Moodle dataroot, and database. You may also want to backup configuration files too if you don't keep these in any form of configuration management system.

Andrew