Getting files under git
I have files that live in path like: www/foo and www/foo/bar
I want some of these files to be under a local git repo -- without moving them anywhe开发者_JAVA百科re. I haven't setup my repo yet.
What should be the steps that I follow?
Should I create a bare repo, add the files to that repo, and then clone it to those directory paths? I am not sure and I don't want to overwrite anything.
Thanks!
I'm a little confused by what you are trying to do, if you could explain why you want to do it that would probably help to clarify things, but let me see if I understand you.
You have a directory tree and you want some files under source control and not others?
Assuming that is the case you should use .gitignore to ignore the files you do not want added to source control. So the steps I would follow would be:
1 - Create the repo in the root:
cd www
git init
2 - Setup .gitignore with the correct rules to ignore the files I don't want under source control
3 - Add everything else (including .gitignore) to my repository
git add -A .
git ci
4 - Profit???
精彩评论