git assume unchanged vs skip worktree - ignoring a symbolic link

后端 未结 1 1218
借酒劲吻你
借酒劲吻你 2020-12-05 05:06

I have a problems with a git repository and windows. The problem is that the git repository has a linux symbolic link in it and with developers running windows, that obviou

相关标签:
1条回答
  • 2020-12-05 05:25

    Both options have problems. --assume-unchanged resets itself whenever the index gets discarded (e.g. git reset), so that will probably trip you up sooner or later. Same goes for --skip-worktree... however, you can maintain a local list of files to not check out, so that the skip-worktree bit is set again automatically whenever necessary. Here are the steps:

    • Set core.sparseCheckout to true for the repository.
    • Create a file .git/info/sparse-checkout containing two patterns: * to include everything and !/foo to exclude the symlink foo (/ means anchor to top level).
    • Now, manually set the skip-worktree bit, then delete the symlink.

    Now you can go on without having to fear that git will automatically commit the directory, but note that you will still run into problems if someone explicitly runs git add on the directory or any file in it.

    [Edited to add:] After further discussion, we identified a solution to that last problem: put a .gitignore file with a * pattern inside the directory.

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