markdown 仅在Git中的当前计算机上忽略特定文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 仅在Git中的当前计算机上忽略特定文件相关的知识,希望对你有一定的参考价值。

If you ever edit versioned files such as configuration files that are usually shared but require a slight modification for your dev machine, you should consider excluding those files locally.

If you edit .gitignore the files in question will be ignored on every dev machine. You probably do not want that. Instead consider the following:

First add the files in question to the file at .git/info/exclude. This file is formatted just like .gitignore.

Example:

```
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

config/database.yml
```

If your file already contains unstaged changes you may need to run:

`git update-index --skip-worktree [<file>...]`
Some online sources will tell you to use this command:

`git update-index --assume-unchanged [<file>...]`

Instead I recommend using `--skip-worktree`. The difference between the two is well summarized here:

> --assume-unchanged assumes that a developer should not change a file. This flag is meant for improving git's performance for non-changing folders like SDKs. This allows git to skip these folders when checking which files changed on the local machine.

> --skip-worktree is useful when you instruct git not to touch a specific file ever because developers are likely to change if. For example, if the main repository upstream hosts some production-ready configuration files and you don’t want to accidentally commit changes to those files, --skip-worktree is exactly what you want.

以上是关于markdown 仅在Git中的当前计算机上忽略特定文件的主要内容,如果未能解决你的问题,请参考以下文章

GetResponse() 仅在我的计算机上慢

尝试保存时 VBA 宏抛出错误(但仅在一台计算机上)

GetExpressCheckoutDetails 在 asp.net 中返回会话过期(10411 错误)(仅在某些计算机上)

超出速率限制 - 仅在一台计算机上使用

如何修复仅在一台计算机上运行的 Exe 文件

Hbase-client kerberos 身份验证仅在本地计算机上工作