如何处理 git 存储库中的个性化文件
How to deal with personalization files in git repo
我正在 Git 存储库中处理 Sphinx 项目,存储库中包含一个个性化 (conf.py
) 文件,但每个用户(或至少对我来说)。有没有办法配置 Git 以不跟踪此文件的本地副本?
您可以将它添加到 .gitignore
文件,然后提交 .git忽略文件.
这样,您对 conf.py
所做的任何本地更改都将被 git 忽略,并且您可以让每个用户在本地保留他或她自己的配置。
这里有一个很好的解释如何在这种情况下进行 -
在 Git 跟踪的文件中保留本地修改
the magic words are:
git update-index --skip-worktree FILENAME
Where “FILENAME” is the name of the file I want to keep local changes
in.
There’s a matching “–no-skip-worktree” to flip that bit back off.
With this bit set on a file, local changes to the file will not show
up in git status listings.
我正在 Git 存储库中处理 Sphinx 项目,存储库中包含一个个性化 (conf.py
) 文件,但每个用户(或至少对我来说)。有没有办法配置 Git 以不跟踪此文件的本地副本?
您可以将它添加到 .gitignore
文件,然后提交 .git忽略文件.
这样,您对 conf.py
所做的任何本地更改都将被 git 忽略,并且您可以让每个用户在本地保留他或她自己的配置。
这里有一个很好的解释如何在这种情况下进行 - 在 Git 跟踪的文件中保留本地修改
the magic words are:
git update-index --skip-worktree FILENAME
Where “FILENAME” is the name of the file I want to keep local changes in.
There’s a matching “–no-skip-worktree” to flip that bit back off.
With this bit set on a file, local changes to the file will not show up in git status listings.