1

git diff result is following.

>git diff
diff --git a/.husky/commit-msg b/.husky/commit-msg
old mode 100755
new mode 100644
diff --git a/.husky/pre-commit b/.husky/pre-commit
old mode 100755
new mode 100644
diff --git a/deploy/build.sh b/deploy/build.sh
old mode 100755
new mode 100644
diff --git a/deploy/container2local.sh b/deploy/container2local.sh
old mode 100755
new mode 100644
diff --git a/scripts/capture_all_test.sh b/scripts/capture_all_test.sh
old mode 100755
new mode 100644
diff --git a/src/hooks/useFuse.ts b/src/hooks/useFuse.ts
old mode 100755
new mode 100644
diff --git a/src/hooks/useSortableData.ts b/src/hooks/useSortableData.ts
old mode 100755
new mode 100644

git status result is following.

On branch feature/NFTmarketplace
Your branch is up to date with 'origin/feature/NFTmarketplace'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   .husky/commit-msg
        modified:   .husky/pre-commit
        modified:   deploy/build.sh
        modified:   deploy/container2local.sh
        modified:   scripts/capture_all_test.sh
        modified:   src/hooks/useFuse.ts
        modified:   src/hooks/useSortableData.ts

no changes added to commit (use "git add" and/or "git commit -a")

There is no content difference, but only mode difference. I want to discard these changes. I did all approaches on How do I discard unstaged changes in Git?

But none of them works.

How can I do this?

Code Plus
  • 150
  • 1
  • 12
  • Please, post the output of `git status`. – Antonio Petricca Mar 24 '22 at 13:38
  • @AntonioPetricca, I added `git status` result to post. – Code Plus Mar 24 '22 at 13:42
  • 2
    Well, the brute-force approach should always work: `git ls-files -m -z | xargs -0 chmod 755` – Boldewyn Mar 24 '22 at 13:43
  • 1
    "None of them works" is unclear, could you elaborate? If you still see the same status/diff output, it *could* be that said methods worked, but the same cause (some settings in your IDE? Something else?) changed it back again. Not saying it's the case, but to be considered/examined. – Romain Valeri Mar 24 '22 at 13:44
  • @RomainValeri, your comment is very interesting. Could the OS difference cause this problem? I am currently using Windows 10, but I am not sure the original project was developed on which OS. – Code Plus Mar 24 '22 at 13:51
  • Not just the OS per se, I doubt it. I'm working with similar conditions (Linux VM hosted on a Windows10, all files LF in the project) and it's fine. – Romain Valeri Mar 24 '22 at 14:17
  • Windows in general does not support Linux-style permissions. Git should have detected this and should have configured your Git repository with `core.filemode` set to `false`. If your Windows system *does* support Linux-style file permissions, the `chmod` in @Boldewyn's comment should fix things; if not, figure out why `core.filemode` is set to `true` instead of `false`, and set it to `false` for now but figure out if you're sharing a Git repository across OSes (a very bad idea!). – torek Mar 24 '22 at 15:31

0 Answers0