1

In my htdocs folder, I have too many projects, some of them has its git repository initialized inside it, others don't have.

I want to create a git repository in the root "htdocs" folder, to push it to an online repository to ensure all my work is backed up.

Will be any conflict creating it? I'm afraid it can affect the subfolders repositories a way or another.

darroosh
  • 751
  • 2
  • 7
  • 18

1 Answers1

1

to push it to an online repository to ensure all my work is backed up.

That would be conflating git with a backup tool, which it is not.
(although there is a tool based on git which does that: bup)

Plus, the htdocs git repo would not see all the nested git sub-folder you already have.
It would record only gitlinks (special entries in the index), one per sub-repos, without recording their actual content. So in your case, that would work, but would generate a potentially huge repo with way too many files (see "Git with large files"). A git bundle would help compressing the repo to one file, but that would leave out the local config files and other local settings.Sometimes, a simple tar is enough.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thakn you.So you mean that it would record the gitlinks for the git sub-folders, but for the sub-folder that doesn't contain git repos, it will record them... If so that's exactly what I need. And by the way, why can't I use git for backup?? If I lost my htdocs, I can pull them from the online repo. – darroosh Apr 22 '16 at 22:33
  • @darroosh you can use git for backup, but it is not designed with that feature in mind. If you are still using it for backup, I would recommend using git bundle in order to generate a single file, which is easier to backup. See http://stackoverflow.com/a/2129286/6309 – VonC Apr 22 '16 at 22:36
  • @darroosh A simple tar would work too and would be more complete: http://stackoverflow.com/a/6702917/6309 – VonC Apr 22 '16 at 22:36
  • @darroosh For git being ill-suited for backup, see the second and third part of http://stackoverflow.com/a/19494211/6309. – VonC Apr 22 '16 at 22:37
  • Thank you for your help. Please confirm this is wt you meant in your reply: git would record the gitlinks for the git sub-folders, but for the sub-folder that doesn't contain git repos, it will record them... is it? – darroosh Apr 22 '16 at 22:50
  • @darroosh yes, the subfolders which have no .git in them would be versioned in your htdocs repo. – VonC Apr 22 '16 at 22:51
  • And the already existing repos itself wouldnot be affected at all? – darroosh Apr 22 '16 at 22:52
  • @darroosh no, they would not be aware of the parent repo. – VonC Apr 22 '16 at 22:53