简体   繁体   中英

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?

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?

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM