[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Committing git working tree with other git repos



On Wed, Mar 13, 2024 at 07:29:39PM +0100, john doe wrote:

> On 3/13/24 16:04, Paul M Foster wrote:
> > Folks:
> > 
> > I have a /home/paulf/stow directory with contains subdirectories for each
> > of the packages whose dotfiles I want to manage, like:
> > 
> > /home/paulf/stow/alacritty
> > 
> > In each subdirectory, I have all the config files for that packages, under
> > git management. This means that the directory will look like this:
> > 
> > /home/paulf/stow/alacritty/.git
> > /home/paulf/stow/alacritty/.config/alacritty/alacritty.yml
> > 
> > This works well with stow (configs are now symlinks in $HOME).
> > 
> > I'd like to copy all of this to a git repo on gitlab. You would think you
> > could go to the ~/stow directory, "git init", then "git add" each
> > directory, and all is good. However, git looks inside the directories and
> > sees there are already .git directories there, and refuses to add the
> > directories and their contents to its repo. Instead, it wants you to use
> > "submodules", to wit:
> > 
> > git submodule add ./alacritty
> > 
> > This adds an *empty* alacritty subdirectory to the git repo, which isn't
> > useful.
> > 
> > I need a way to bring all these subdirectories and their contents under a
> > git repo so I can send it to gitlab. Any suggestions?
> > 
> > 
> 
> Sometime, learning something new is better than trying to get your own
> way! ;^)
> 
> I can only suggest you to dig into Git submodules.

I've read through https://git-scm.com/book/en/v2/Git-Tools-Submodules , and
it appears that submodules aren't really made for what I'm trying to do.
According to the docs, a submodule is more or less a link to an external
code repo. When used properly with the proper commands, the remote code can
be reconstituted. However, if you read the above, this won't work for my
purposes. That's why I asked the original question.

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster


Reply to: