如何删除适用于文件的 .exec 扩展名 git?
How do I remove the .exec extension git applies to files?
我搞砸了所以我下载了一个旧的提交并尝试从一些按预期运行的旧代码构建。我看到文件(Podfile、License Gemfile 等)现在有一个 .exec 扩展名,当我推送到 bitBucket 时,它们有一个“+x”注释。当你将鼠标悬停在它上面时,它说这个文件现在是可执行的。
一切仍然碰巧构建并且 运行 成功,但为什么 git 在我不说的情况下将此扩展名添加到我的文件中?这个问题引起了我的拉取请求的一些担忧。我如何 return 我的文件只是纯文本或它们原来的样子?
我已经尝试 运行 chmod -x $(find . -type exec) 在有问题的目录中,但这似乎不起作用。
谁知道如何将我的文件恢复到原来的纯度???
你可以:
- 重命名文件
- 再次添加它们,使用
git add --chmod=-x aFile
明确删除 'x' 可执行位
然后你可以提交并再次推送。
但请确保使用 Git 2.31(2021 年第一季度),因为对“git add --chmod
"(man)”的各种修复。
参见 commit 9ebd7fe, commit 4896089, commit c937d70 (22 Feb 2021) by Matheus Tavares (matheustavares
)。
(由 Junio C Hamano -- gitster
-- in commit f277234 合并,2021 年 2 月 25 日)
add
: propagate --chmod
errors to exit status
Signed-off-by: Matheus Tavares
Reviewed-by: Taylor Blau
If add
encounters an error while applying the --chmod
changes, it prints a message to stderr, but exits with a success code.
This might have been an oversight, as the command does exit with a non-zero code in other situations where it cannot (or refuses to) update all of the requested paths (e.g. when some of the given paths are ignored).
So make the exit behavior more consistent by also propagating --chmod
errors to the exit status.
并且:
add --chmod
: don't update index when --dry-run
is used
Helped-by: Junio C Hamano
Signed-off-by: Matheus Tavares
Reviewed-by: Taylor Blau
git add --chmod
(man) applies the mode changes even when --dry-run
is used.
Fix that and add some tests for this option combination.
我搞砸了所以我下载了一个旧的提交并尝试从一些按预期运行的旧代码构建。我看到文件(Podfile、License Gemfile 等)现在有一个 .exec 扩展名,当我推送到 bitBucket 时,它们有一个“+x”注释。当你将鼠标悬停在它上面时,它说这个文件现在是可执行的。
一切仍然碰巧构建并且 运行 成功,但为什么 git 在我不说的情况下将此扩展名添加到我的文件中?这个问题引起了我的拉取请求的一些担忧。我如何 return 我的文件只是纯文本或它们原来的样子?
我已经尝试 运行 chmod -x $(find . -type exec) 在有问题的目录中,但这似乎不起作用。
谁知道如何将我的文件恢复到原来的纯度???
你可以:
- 重命名文件
- 再次添加它们,使用
git add --chmod=-x aFile
明确删除 'x' 可执行位
然后你可以提交并再次推送。
但请确保使用 Git 2.31(2021 年第一季度),因为对“git add --chmod
"(man)”的各种修复。
参见 commit 9ebd7fe, commit 4896089, commit c937d70 (22 Feb 2021) by Matheus Tavares (matheustavares
)。
(由 Junio C Hamano -- gitster
-- in commit f277234 合并,2021 年 2 月 25 日)
add
: propagate--chmod
errors to exit statusSigned-off-by: Matheus Tavares
Reviewed-by: Taylor Blau
If
add
encounters an error while applying the--chmod
changes, it prints a message to stderr, but exits with a success code.
This might have been an oversight, as the command does exit with a non-zero code in other situations where it cannot (or refuses to) update all of the requested paths (e.g. when some of the given paths are ignored).
So make the exit behavior more consistent by also propagating--chmod
errors to the exit status.
并且:
add --chmod
: don't update index when--dry-run
is usedHelped-by: Junio C Hamano
Signed-off-by: Matheus Tavares
Reviewed-by: Taylor Blau
git add --chmod
(man) applies the mode changes even when--dry-run
is used.
Fix that and add some tests for this option combination.