I use Git in Windows, and want to push the executable shell script into git repo by one commit.
Usually I need to do two steps (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
How can I combine these two steps into one step? git configuration? windows command?
Reference: see question in Git file permissions on Windows for second commit
git add --chmod=+x
is actually possible. See my answer below, credit to Edward Thomson.git add --chmod=+x
version