%f 在 git clean/smudge 过滤器中代表什么
What does %f represent in the git clean/smudge filters
在我的 ~/.gitconfig
文件中,我看到有以下 lfs 过滤器:
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
问题: %f
在lfs过滤器中代表什么?我的理解是它代表文件路径,但我不确定它代表什么文件路径。
在.gitattributes
"filter
" section中显示为:
Sequence "%f
" on the filter command line is replaced with the name of the file the filter is working on.
A filter might use this in keyword substitution. For example:
[filter "p4"]
clean = git-p4-filter --clean %f
smudge = git-p4-filter --smudge %f
Note that "%f
" is the name of the path that is being worked on.
Depending on the version that is being filtered, the corresponding file on disk may not exist, or may have different contents.
So, smudge
and clean
commands should not try to access the file on disk, but only act as filters on the content provided to them on standard input.
在我的 ~/.gitconfig
文件中,我看到有以下 lfs 过滤器:
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
问题: %f
在lfs过滤器中代表什么?我的理解是它代表文件路径,但我不确定它代表什么文件路径。
在.gitattributes
"filter
" section中显示为:
Sequence "
%f
" on the filter command line is replaced with the name of the file the filter is working on.
A filter might use this in keyword substitution. For example:[filter "p4"] clean = git-p4-filter --clean %f smudge = git-p4-filter --smudge %f
Note that "
%f
" is the name of the path that is being worked on.
Depending on the version that is being filtered, the corresponding file on disk may not exist, or may have different contents.So,
smudge
andclean
commands should not try to access the file on disk, but only act as filters on the content provided to them on standard input.