2

I have two bitbucket repo in which the first repo contains all the Liferay related sdk, the second repo contains only the projects(have four folder such as hooks, portlets, layoutpl, themes).

I took the clone of the first repo which contains the SDK, lets say the folder name is liferay-sdk. now on to the same liferay-sdk in need hooks, portlets, layoutpl, themes folders which are in repo two.

But now when I tried to pull the repo two contents onto the same liferay-sdk folder it is giving me Folder not empty.

I am using Source Tree.

Note: I need commit and push privilege needed only to hooks, portlets, layoutpl, themes in source tree and not to the other things in liferay-sdk. How can we ignore things expect hooks, portlets, layoutpl, themes in liferay-sdk

Can anyone please tell me some solution for this

Alex Man
  • 4,746
  • 17
  • 93
  • 178

1 Answers1

2

But now when I tried to pull the repo two contents onto the same liferay-sdk folder it is giving me Folder not empty.

Yes, you cannot clone a repo using a existing non-empty folder.

You could clone the second repo within the first:

cd liferay
git clone /url/second_repo

But that would give you:

  • a nested git repo (meaning liferay-sdk would at minimum record a gitlink, special entry in the parent repo)
  • a nested subfolder (meaning hook is not directly under liferay-sdk, but rather in liferay-sdk/second_repo/hooks)

That would remain true even if you were using submodules.

Instead, you could:

  • clone the second repo elsewhere
  • make symlink (ln -s or mklink /J on Windows) for the four folders you want directly under liferay-sdk to second_repo/xxx (hooks, etc).
  • add those symlink folder names (like hooks) to your liferay-sdk .gitignore file.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • But can we track the updates for `hooks, portlets, layoutpl, themes` folder if we put those under `.gitignore` file...can you give a more details on that. I don't need to track any updates for likferay-sdk files – Alex Man Feb 08 '17 at 05:52
  • @AlexMan Adding them in your gitignore will make the parent repo ignore them. But the second repo will still continue to track any evolution: you will still be able to add, commit and push from the second repo. – VonC Feb 08 '17 at 05:53
  • I am not that expert in git...it would be great helpful if you can specify me the steps with the command i need to do – Alex Man Feb 08 '17 at 05:56
  • @AlexMan Said steps are in the answer: clone the second repo anywhere you want *outside* the first repo and add symlinks (symlinks are not git commands, just a system way of linking folders) – VonC Feb 08 '17 at 05:57
  • Is it like this `mklink /J D:\second-repo D:\liferay-sdk` – Alex Man Feb 08 '17 at 06:01
  • @AlexMan on Windows, it is `cd D:\liferay-sdk` and: `mklink /J hooks D:\second_repo\hooks`: that will create a subfolder symlink (junction) `hooks` in `D:\liferay-sdk`, pointing to `D:\second_repo\hooks` – VonC Feb 08 '17 at 06:18