Updating and committing only a file's permissions using git version control

前端 未结 3 453
难免孤独
难免孤独 2020-11-27 10:09

Just turned an some.sh file into an executable (chmod 755 ...), the permissions were updated but not the content. Is there a way to commit

3条回答
  •  不知归路
    2020-11-27 10:55

    @fooMonster article worked for me

    # git ls-tree HEAD
    100644 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe    script.sh
    

    As you can see the file has 644 permission (ignoring the 100). We would like to change it to 755:

    # git update-index --chmod=+x script.sh
    

    commit the changes

    # git commit -m "Changing file permissions"
    [master 77b171e] Changing file permissions
    0 files changed, 0 insertions(+), 0 deletions(-)
    mode change 100644 => 100755 script.sh
    

提交回复
热议问题