简体   繁体   中英

Save a project in Git, if files are located in different directories

I want to save a project in Git, a VHDL Xilinx project whose sub files are located in different directories. My working directory and file locations are at different locations since I am allowed to keep it in the same location because of company conditions. Running git init in the home folder will probably not help it because the project contains more than 100 files.

Is there any way to include only the files I need, but from different directories, without copying to the working directory?

In case you won't be able to get a better answer... As you said, you can create a git init in home folder and add a .gitignore in which you would ignore all files except the ones you need, like this: Make .gitignore ignore everything except a few files . The drawbacks are that you need to list all the directories you want to track and there is also risk that you will skip tracking something important without even knowing about that.

Another way would be creating submodules (git submodule). with submodules you can have a separate git repository that can be managed from a dedicated directory (which you could even create for the sake of management only. It can be also cumbersome because of the quanity of directories (subrepositories) to track but maybe it is worth a try in your case.

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