tl,dr version:
Is it to be expected that code added to a repo via "git subtree add" shows in that (server side) repo as if it had been added as regular files? Are the files showing a copy or (as hoped) just a reference?
full version:
I'm pretty new to git (used SVN and Perforce excessively before, but in my new job, we're using gitlab now) and recently decided to move out part of the code I have in my current software project's repository to a separate repo, since that seemed to make more sense structurally. To be precise, I stripped out a folder 'Infrastructure' from my current project (let's call that 'DynamicDisplays') via "subtree split".
I followed these guides
- https://makingsoftware.wordpress.com/2013/02/16/using-git-subtrees-for-repository-separation
- https://stackoverflow.com/a/17864475
- https://lostechies.com/johnteague/2014/04/04/using-git-subtrees-to-split-a-repository/
to the best of my knowledge.
I removed and re-added the folder from the "DynamicDisplays" GitLab project (their extended version of the server side repository. I'm not too saddle fast in git's terminology yet) via
git subtree add --prefix=Infrastructure Infrastructure master
as described in the tutorials.
I do have the separate project ("Infrastructure") for the repo I wanted to split off now, and I do see the commit about the removal of the split off code in the "DynamicDisplays" GitLab project.
But the "DynamicDisplays" GitLab project still seems to contain that content (everything in the "Infrastructure" subfolder) as well — at least the project's file/folder structure view still shows it).
The GitLab project shows a commit "Merge commit '018973f3' as 'Infrastructure'" from when I did the "subtree add". Did that re-introduce the content (as opposed to "just a reference")?
I also see no way to distinguish the subtree contents from 'native' repository contents in the local file browser (Explorer in my case, since I'm on Windows 8.1 here at work).
Should this be the case? Do I just see the referenced contents and everything worked as expected? Do you know of a way to check and maybe visualize this (as it might make a difference for future users of the project)?
Unfortunately, noone here knows git either, the one person that introduced it has since moved on again (before I even joined), and before that, they didn't use any RCS at all (most even still don't). So there's nobody here that I could ask.
Edit:
After some more experimentation (and commits & pushes to the 'Infrastructure' repository), I get no notice in the repo containing the subtree that files have changed in the master 'Infrastructure' repo. Which was kinda part of what I was after.
Does anyone have an idea about how I can reference another repo like that? Will I have to use submodules instead (or are they not able to provide that either?)?
I went with subtree because of many recommendations to use that in submodule's stead for easier management, but I currently don't see it having any advantage over just copying the code over… which is a total shame, and I'm pretty sure I only missed something somewhere.