是否有可能拥有所有“git diff”命令在所有git项目中使用“Python diff”? [英] Is it possible to have all "git diff" commands use the "Python diff", in all git projects?
问题描述
当包含这行
*。py diff = python
在一个本地的.gitattributes文件中, git diff
为Python文件的不同diff区域生成不错的标签以及更改所在的函数的名称等)。
是否有可能要求git使用此差异模式来处理所有 所有 git项目中的Python文件?我试图设置一个全局〜/ .gitattributes,但它不被本地git存储库使用。是否有比使用 ln -s〜/ .gitattributes
?
从引用gitattributes(5)
:
应该影响单个用户的所有存储库的属性应放置在由core.attributesfile配置选项指定的文件中(请参阅git-config(1))。它的默认值是$ XDG_CONFIG_HOME / git / attributes。如果$ XDG_CONFIG_HOME未设置或为空,则改为使用$ HOME / .config / git / attributes。系统中所有用户的属性应放置在$(前缀)/ etc / gitattributes文件中。
When including the line
*.py diff=python
in a local .gitattributes file, git diff
produces nice labels for the different diff hunks of Python files (with the name of the function where the changes are, etc.).
Is is possible to ask git to use this diff mode for all Python files across all git projects? I tried to set a global ~/.gitattributes, but it is not used by local git repositories. Is there a more convenient method than initializing each new git project with a ln -s ~/.gitattributes
?
Quoting from gitattributes(5)
:
Attributes that should affect all repositories for a single user should be placed in a file specified by the core.attributesfile configuration option (see git-config(1)). Its default value is $XDG_CONFIG_HOME/git/attributes. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/attributes is used instead. Attributes for all users on a system should be placed in the $(prefix)/etc/gitattributes file.
这篇关于是否有可能拥有所有“git diff”命令在所有git项目中使用“Python diff”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!