You are not logged in.
Hi all!
A while ago I had an idea to have my computer track my config files for me, so now I have a small repository for my configs which I store in git (and on bitbucket).
What I actually noticed that the ~/.git folder becomes bloated (right now it takes around 364 Mb, and on my laptop it was a few Gb actually.. For around a megabyte of text files)
Sooo.. I'm not a git guru, this behavior seems strange and I don't know how to fix that. Am I just doing something strange and using a wrong tool here?
Last edited by cra (2013-04-04 12:55:33)
Thou shalt not make a machine in the likeness of a human mind
Offline
See if gc helps:
git gc
For me it shrank my .git size considerably:
$ du -hxd 0 .git
480K .git
$ git gc
Counting objects: 92, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (90/90), done.
Writing objects: 100% (92/92), done.
Total 92 (delta 41), reused 0 (delta 0)
$ sync
$ du -hxd 0 .git
112K .git
'man git-gc' for more information, options, etc.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Another option, which I think more people do, is to store their config files under a separate directory and then use a tool to symlink those files back into their home directory. Then you only have to keep that specific config file directory under version control.
For example, I have a directory called dotfiles, and under it are directories for each program. Each program directory has all of its dotfiles laid out exactly as they would be laid out in my home directory. So, for example:
/home/brandon/dotfiles/
bash/
.bashrc
.bash_profile
newsbeuter/
.config/newsbeuter/urls
I keep the dotfiles directory under version control.
I then use Stow to create symlinks back into my home directory:
$ stow bash
$ stow newsbeuter
$ ls -l ~/.bash_rc
lrwxrwxrwx 1 brandon users 1K Nov 8 16:41 /home/brandon/.bashrc -> dotfiles/bash/.bashrc
When you set up a new system, you only need to stow the programs you actually need. So, for example, I don't use vim anymore but I still have my config files. If I ever decide to switch back, I just need to stow vim to have them back. Until then, they're tucked neatly away, not cluttering up my home directory.
This will spare you from having git worry about every file in your home directory.
Last edited by jakobcreutzfeldt (2013-03-27 13:44:43)
Offline
Well, it did something, but not much..
[cra@hannelore 14:42:44 ~]
$ du -hs .git
364M .git
[cra@hannelore 14:42:50 ~]
$ du -hxd 0 .git
364M .git
[cra@hannelore 14:42:54 ~]
$ git gc
Counting objects: 86, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (79/79), done.
Writing objects: 100% (86/86), done.
Total 86 (delta 21), reused 0 (delta 0)
[cra@hannelore 14:42:57 ~]
$ du -hxd 0 .git
240M .git
[cra@hannelore 14:42:59 ~]
$ sync
[cra@hannelore 14:43:04 ~]
$ du -hxd 0 .git
240M .git
[cra@hannelore 14:43:05 ~]
$
Also 'git status' shows a lot of files I haven't added myself (??) as "new files" under "Changes to be commited".
And 'gitk --all' shows a fun entry "Local changes checked in to index but not committed". I'm puzzled %)
Thou shalt not make a machine in the likeness of a human mind
Offline
Another option, which I think more people do, is to store their config files under a separate directory and then use a tool to symlink those files back into their home directory. Then you only have to keep that specific config file directory under version control.
[...]
I then use Stow to create symlinks back into my home directory
[...]
This will spare you from having git worry about every file in your home directory.
This workflow sounds much more convenient, thanks for sharing!
So, just to make sure I got it right: you have a separate folder just for dotfiles which is actually in your git repo or some other cvs, and your local actual config files are not tracked?
Thou shalt not make a machine in the likeness of a human mind
Offline
This workflow sounds much more convenient, thanks for sharing!
So, just to make sure I got it right: you have a separate folder just for dotfiles which is actually in your git repo or some other cvs, and your local actual config files are not tracked?
Right. Basically:
$ cd ~
$ mkdir dotfiles
$ cd dotfiles
$ git init
$ mkdir bash
$ mv ../{.bashrc,.bash_profile} bash
$ git add bash
$ git commit
$ stow bash
...and so on.
I forgot to mention that it's also easy to clean up. Say you don't want the config files of a program anymore, you just do stow -D program to remove the symlinks.
Offline
Also note that there are 5 or 6 million tools to accomplish similar things but I found most of them to be complete overkill. I don't want to have to learn a ton of commands for a tool that I won't use very often. I also don't want to have to install a ton of Ruby dependencies to do it. I found Stow to be the simplest solution, short of doing the symlinking myself. Anyway, have a look around, you might find a different solution that suits your needs/style better.
Offline
So, for example, I don't use vim anymore
This example will get you banned on this forum. Careful there
Anyway, nice workflow, thank you!
zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)
Offline
Cool. It works, I love the simplicity of stow
Thanks!
Thou shalt not make a machine in the likeness of a human mind
Offline