From ~/
home directory in Linux, I would like to create a repository of useful files that I have customized over time. Specifically, for example, files like ~/.bashrc
or ~/.vimrc
.
Now, the home directory also has a .vim
folder within which there are multiple plugins I have cloned. For e.g., ~/.vim/plugged/vim-snippets
. There is also the .git/
folder within this folder at ~/.vim/plugged/vim-snippets/.git
. These are repositories I cloned merely to use as a user. They are developed and maintained by someone else.
The presence of this latter .git/
folder seems to prevent being able to track anything within the ~/.vim/plugged/vim-snippets/
folder or its subfolders from the repository I would like to create in ~/
. Some of the files within ~/.vim/plugged/vim-snippets/
that I have customized and changed include ~/.vim/plugged/vim-snippets/UltiSnips/tex.snippets
,for instance, which contains my customization for LaTeX files. I would like to put this file under my personal source control repository under ~/
.
Regardless of having !/.vim/plugged/vim-snippets/
in ~/.gitignore
the tex.snippets
file is not tracked. However, everything else being the same, removing the .git
folder from ~/.vim/plugged/vim-snippets
does track the tex.snippets
file.
Is there anyway this problem can be resolved? I looked at submodules, but note that I do not want to commit to my repository under ~/
everything under ~/.vim/plugged/vim-snippets/
which seems to be the problem addressed by submodules. I only customize one or two files within ~/.vim/plugged/vim-snippets/
that I would like to commit to my personal source control repository under ~/
. Is deleting the .git/
folder from /.vim/plugged/vim-snippets/
the only way to achieve this?
CodePudding user response:
There's no Git way to do quite what you want—or at least, what I think you want, which is a kind of overlay/interleave thing.
I have, for my own personal use, my own personal dot-files system, and I would have the same issue if I customized directly-cloned repositories. For now, if I did that, I'd go ahead and use submodules (or add something much like them to my personal dot-files system). So far I have been fortunate in that the additional vim goodies I use are already sufficiently customizable without touching the original repository, that I don't have to do that. So I have not actually implemented either of the tricks you're talking about.
What's really needed here, though, is a way to say "use a tree from some Git repository's commit, but use only these parts of it and/or overlay these other items into it". This doesn't fit with the Git model so the clone, if any, of the other Git repository should go outside the assembled tree-of-files, and the tree-of-files should be able to live outside the Git repository.