我有一个项目,我必须chmod在开发过程中将文件模式更改为777,但不应在主回购中更改.
Git选择chmod -R 777 .并将所有文件标记为已更改.有没有办法让Git忽略对文件进行的模式更改?
我在Windows中使用Git,并希望通过一次提交将可执行shell脚本推送到git repo.
通常我需要做两个步骤(git commit).
$ vi install.sh
$ git add install.sh
$ git commit -am "add new file for installation" # first commit
[master f2e92da] add support for install.sh
1 files changed, 18 insertions(+), 3 deletions(-)
create mode 100644 install.sh
$ git update-index --chmod=+x install.sh
$ git commit -am "update file permission" # second commit
[master 317ba0c] update file permission
0 files changed
mode change 100644 => 100755 install.sh
Run Code Online (Sandbox Code Playgroud)
如何将这两个步骤合并为一步?git配置?Windows命令?
提醒:两个答案都很好,git add --chmod=+x file新git版本支持
参考: …