Conversation

Jarkko Sakkinen

Sometimes it would be useful if you could have multiple Git repositories in the same clone as long as they don't share files. E..g, for separating private data.

#git
4
0
0

@jarkko how about two repo's or one repo and a submodule and something like mergerfs? Alternatively if the software has something like a search path (like shell or python) you can replicate the same directory structure in both and put private before public in the path.

0
0
0
I explained myself badly.

Git as GIT_DIR and --git-dir for specifying location of the ".git".

What would be nice if there was also something like --git-dir-alias or similar for specifying non-standard name for that directory.

Then I could along the lines of

git clone <project URL>
cd <project>
export GIT_DIR_ALIAS=".git-private"
git init && git remote -add origin <private data URL> && git fetch origin && git reset --hard origin/main
unset GIT_DIR_ALIAS

It's not uncommon to initialize Git repositories to populated directories. E.g. that is how I clone my home directory skeleton on a new system:

git clone https://codeberg.org/jarkko/skeleton
git reset --hard origin/main

This is just extension to it. Home directories are great example use case also because then you could have separate Git repositories, if you want to isolate settings of a particular program but still have means to deploy them under the same root where they are cloned.
1
0
1

Jarkko Sakkinen

Edited 3 days ago
Also you might want to keep your account files for command-line tools in a different private repository even if it does not contain passwords (as it shouldn't but instead use pass). It still contains e.g., email addresses and stuff like that.

Without a special Git feature you need to fix the problem in your configuration. I.e copy the files from a clone, which is incovenient.
0
0
0
@thomasmey i'm aware of this stuff but yeah i'm talking about something much more simple and stupid (see my respnoses) :-)

I even have developed this small function to my shell config number of years ago that pulls tag from any git repository to another that I've sometimes found convenient:

function git-fetch-tag
git fetch --no-tags "$argv[1]" "refs/tags/$argv[2]:refs/tags/$argv[2]"
end

(currrently a fish version of it :-) )
0
0
0