Git Symlinks in Windows

前端 未结 13 1458
执念已碎
执念已碎 2020-11-22 09:23

Our developers use a mix of Windows and Unix based OS\'s. Therefore, symlinks created on Unix machines become a problem for Windows developers. In windows (msysgit), the sym

13条回答
  •  野性不改
    2020-11-22 09:34

    I was looking for an easy solution to deal with the unix symbolic links on windows. Thank you very much for the above Git aliases. There is one little optimization that can be done to the rm-symlinks so that it doesn't delete the files in the destination folder in case the alias is run a second time accidentally. Please observe the new if condition in the loop to make sure the file is not already a link to a directory before the logic is run.

    git config --global alias.rm-symlinks '!__git_rm_symlinks(){
    for symlink in $(git ls-files -s | egrep "^120000" | cut -f2); do
        *if [ -d "$symlink" ]; then
          continue
        fi*
        git rm-symlink "$symlink"
        git update-index --assume-unchanged "$symlink"
    done
    }; __git_rm_symlinksenter 
    

提交回复
热议问题