I want to add a project which is located in my documents into a git repository, is this do-able? Thanks, I've never used git before
- 1How far have you got? What have you read? Are you stuck, or are you just asking if it's even possible, or worth trying? (The short answer is yes.)Benjol– Benjol2010-09-08 08:45:57 +00:00Commented Sep 8, 2010 at 8:45
- I removed the "svn" tag from your posts since this has nothing to do with svn. Please only add relevant tags to your posts.Albin Sunnanbo– Albin Sunnanbo2010-09-08 09:34:55 +00:00Commented Sep 8, 2010 at 9:34
3 Answers
In theory yes:
cd yourRep git init . git add . git commit -m "first commit" You might want to add a .gitignore first in order to not add every file in your directory.
Some of them might not be relevant: see "Started using git recently … just noticed clones of my files with ' ~ ' appended in the end… why is this happening" for instance.
Comments
Certainly. Start by navigating to the root folder of your project. Once you are there execute git init to initialize a git repository in place. This repository is empty. You will have to add the necessary resources before you can commit them.
Start with git add -i. This is an interactive way of adding new resources to the repository. If you wish to add all files then execute git add . instead. It would be a good idea to create a .gitignore file, add the patterns of unnecessary files to it and then do git add .
Once you are done, execute git commit.