[tpm] [OT] Git repo combination
antoniosun at lavabit.com
Thu Jan 17 12:52:47 PST 2013
Thanks a lot for your replies, everyone. Sorry for responding late, because
I've got a lot of reading and trying to do. Now,
First of all, a recap of what I want to do -- I have a local git repo to
track my code, but I wasn't able to find a remote repo for it until
recently. Thus, it is pure local. Now I just want to put my local code under
a sub folder of a remote repo (and keep the histories). Afterward, there
would be only one *combined *repo.
Now, a recap of suggested solutions. Olaf and Matt suggested "git
submodule" and "git subtree". Having read them though, I think the two
method are more toward putting two separated git repo together, while
having a way to maintain them separately. Same goal, different approaches.
As Abram and Bobby, suggested a simple git merge would be good enough for
my case. But the problem for me is that I not only have to know how to do
it, but I had to figure out what git command should I use to do it. so,
On Thu, Jan 17, 2013 at 12:42 PM, Abram Hindle <
abram.hindle at softwareprocess.es> wrote:
> One thing you can do is clone your local repo and then make the subdir in
> the clone. Then you tell the cloned git to move all files into that subdir.
> Then commit that.
I was stuck at trying to move the git root into a sub folder, but in the
end, I made it.
> Now your clone repo needs the commits of the remote repo.So pull the
> branch from remote into the cloned repo. Now you have merged the commits.
This is the step I get stuck again. I wasn't able to figure out what git
command I should use to pull the branch from remote into the cloned repo,
or as Bobby's method, to merge to Repo-B. (I was trying to do "git remote
add origin", but got the "fatal: remote origin already exists" error
for my pure
local git clone; and I don't know how to merge to remote Repo-B at this
> Now you can push back to the remote.
> Now your remote repo has your new local repo inside of it. You probably
> should just use this new local merged repo instead of the old one.
> Abram Hindle
> Sent from my Android powered rock tumbler
> Antonio Sun <antoniosun at lavabit.com> wrote:
> On Thu, Jan 17, 2013 at 11:22 AM, Olaf Alders <olaf.alders at gmail.com>wrote:
>> > An off-topic question on Git -- how to put my locally managed Git repo
>> under a sub-folder of another remote Git repo?
>> > My locally managed Git repo was created totally locally, without any
>> remote repo. Now I hope everything, including the histories, can show up
>> under a sub-folder of another remote Git repo.
>> Hi Antonio,
>> I think you want "git submodule".
> Thanks Olaf,
> That's not quite what I was looking for. For git submodule, "you want to
> be able to treat the two projects as *separate *yet still be able to use
> one from within the other. . . Submodules allow you to keep a Git
> repository as a subdirectory of another Git repository. This lets you clone
> another repository into your project and keep your commits separate."
> I wasn't able to find a remote repo for my local repo until recently, now
> I just want to give my local repo a remote repo, but should be under a sub
> folder. Afterward, there would be only one *combined *repo. Would that be
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the toronto-pm