user596075
user596075

Reputation:

Add Separate Directories/Projects/Files to Git Repository

Say I have this type of structure:

Project/Code files: C:\myCode

Git Repository: C:\Users\User1\MyGitRepoDir

How do I get my myCode code directory into MyGitRepoDir so that I can commit files, etc?

Upvotes: 0

Views: 1242

Answers (2)

Andy
Andy

Reputation: 46512

Three options that I can think of:

  1. Copy paste the code from myCode into MyGitRepoDir

  2. Create a new git repo in myCode with git init

  3. Move the working dir of MyGitRepoDir. Probably don't want to do this if you don't know what you are doing.

Would need more details to provide a recommendation. Is there already code in MyGitRepoDir? Do they need to be in the same repo? Does each folder need to stay in their respective directories?

Upvotes: 2

macduff
macduff

Reputation: 4685

The code must be under the GIT repository root directory for it to be placed under source control. You would have to move/copy the directory. If you really want to have a repo at C:\myCode and then reference it in C:\Users\User1\MyGitRepoDir you would have to use submodules which can be quite painful, but if your application requires it, the complexity is justified. Hope this helps!

Upvotes: 2

Related Questions