Git Management: Single Git at root directory where the files are residing in other directories

Answered

Hi

I have setup a development server and developers will develop the codes in their local machine.

 

In the development server, there is a Git Repository at the directory, S1:\main\. I read that having a single consolidated Git Repository is better than having multiples Git Repositories lying around the system.

 

For each project, the python files will be at a subdirectory ie S1:\main\projectA\python\  or S1:\main\projectB\python\. The Git will have a develop (main branch) , Tom's branch, Henry's branch.

 

Each developer, will pull the python files from the "develop branch" and work in his own local machine. He will have a Git Repository and all his python files will be at the same location C:\ProjectA\  

 

If I create a new file in my C:\ProjectA\ and push it to the "develop branch" and perform a merge at the "develop branch", the file is located at S1:\main\ instead of S1:\main\ProjectA\python\. If I manually cut and paste the file from S1:\main\ into S1:\main\ProjectA\python\, the Git will give me the following error: "Git Merge Failed Your local changes would be overwritten by merge. Commit, stash or revert them to proceed"

 

How do I put the python files at the right directory in the development server so that my local Git can link up with the Development Server's Git?

 

Thanks

 

0
4 comments

Hello Lchu

Could you please elaborate a bit more on the structure of your folders? Where exactly do you have .git folder in S1:\ and C:\?

0

Old structure:

S:\main\.git

S:\main\ (all the python files)

Developer: C:\ProjectA\.git, C:\ProjectA\ (all his python files)

I can easily push the python files and they can be found at S:\main\ (all the python files)

 

New structure:

S:\main\.git

S:\main\ProjectA\python\ (all the python files)

Developer: C:\ProjectA\.git, C:\ProjectA\(all his python files)

Problem: When I push the python files, the files will be at S:\main\ (the pushed python files). I expect to have the files at S:\main\ProjectA\python\ (all the python files)

 

Thanks

 

 

 

 

0

Lchu git clones everything that is located in the folder where .git is located.

So if you want the ProjectA folder to be pushed then .git should be located in the parent directory (C:\someDir\ProjectA & C:\SomeDir\.git)


0

Ruslan Kuleshov, I dont think the folder needs to be in the same directory with .git

After rearranging the python files and .git directories in the S:\. I have to clone S:\someDir\.git back to my local C:\. Then when I push a file locally to S:\someDir\.git, the file will be at the right directory in S:\someDir\ProjectA\

0

Please sign in to leave a comment.