How can I keep two files in sync within the same repository?

前端 未结 2 744
生来不讨喜
生来不讨喜 2021-01-14 06:47

My repository in git looks like this:

-Project Repo
    -Sub Folder 1
         -File 1
         -File A
    -Sub Folder 2
         -SubSub Folder
                    


        
相关标签:
2条回答
  • 2021-01-14 07:28

    Hopefully a symbolic link is all you need.

    If you are in Linux/Unix you would issue the symlink creation command as follows:

    cd ".../Project Repo/Sub Folder 2/"
    ln -s "../Sub Folder 1/File 1" "File 2"
    

    In a version of Windows that support symbolic links, you can try the mklink command:

    cd ...\Project Repo\Sub Folder 2
    mklink "File 2" "..\Sub Folder 1\File 1"
    
    0 讨论(0)
  • 2021-01-14 07:32

    If you are doing things on windows, I assume you are using Visual Studio. What I have done in the past is used pre-compile steps in the project properties to copy the file over from one location to the other. The copy of the file in the new location is explicitly ignored so it won't get committed.

    0 讨论(0)
提交回复
热议问题