user3540246 user3540246 - 29 days ago 8
Git Question

git windows add symlink file as file

I have big (more 1000 files) VS C# project in git. I need create small demo project and use 10 files from big project. I create new solution with project and add 10 files with mklink (symlink) from big to small. All changes in files are in big and small project. Now i need add small project to different (own) git repo.

But symlink not add in git


(error: readlink("X.cs"): Function not implemented)


How add X.cs (symlink) file in git as usual file?

I need all changes in X.cs (in big project) move to X.cs (small project).

Answer

git has problems with individual file links but it has no problem with directory symbolic links(mklink /d ). Therefore move your image files to another directory in your big project and create directory link in your git repo to this directory.

See below for example.

P:\denemeler\gitdeneme1>mklink /d linkDirectory P:\puzzles

Created symbolic link : linkDirectory <<===>> P:\puzzles

P:\denemeler\gitdeneme1>git status On branch master Untracked files:
(use "git add ..." to include in what will be committed)

    linkDirectory/

nothing added to commit but untracked files present (use "git add" to track)

P:\denemeler\gitdeneme1>git add linkDirectory

P:\denemeler\gitdeneme1>git status

On branch master Changes to be committed: (use "git reset HEAD ..." to unstage)

    new file:   linkDirectory/Juggle Fest Question.txt
    new file:   linkDirectory/jugglefest.txt
    new file:   linkDirectory/triangle.txt
    new file:   linkDirectory/triangleQuestion.txt

P:\denemeler\gitdeneme1>git commit -m "new files"

[master 0c7d126] new files 4 files changed, 14150 insertions(+) create mode 100644 linkDirectory/Juggle Fest Question.txt create mode 100644 linkDirectory/jugglefest.txt create mode 100644 linkDirectory/triangle.txt create mode 100644 linkDirectory/triangleQuestion.txt

P:\denemeler\gitdeneme1>echo "aa" > p:\puzzles\newFile.txt

P:\denemeler\gitdeneme1>git status

On branch master Untracked files:
(use "git add ..." to include in what will be committed)

    linkDirectory/newFile.txt

nothing added to commit but untracked files present (use "git add" to track)