gradlew.bat file is not getting discarded from vscode

Viewed 562

I am trying to discard gradlew.bat file, which was not modified but still in vscode it appears in modified section. It is not getting discarded. In difference it doesnt show any difference between these 2 files.

I tried git status and get response as modified: android/gradlew.bat

git diff returns:

diff --git a/android/gradlew.bat b/android/gradlew.bat
index ac1b06f9..107acd32 100644
--- a/android/gradlew.bat
+++ b/android/gradlew.bat
@@ -1,89 +1,89 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem      https://www.apache.org/licenses/LICENSE-2.0
-@rem
:

Screenshot of vscode

EDIT:

I fixed this by using hard reset, follow below commands:

  1. git rm --cached -r .

  2. git reset --hard

1 Answers

Maybe they look the same but you probably don't see all special characters in files. It might be the problem with encoding. You should double check it.

If you want to ignore the file, here is the explanation with instruction:

File will be not traced only if it has never been changed. You added to .gitignore a file which still exists in your repository. You must unlink it.

  1. You must first delete this file and commit the changes.
  2. Then add to .gitignore an entry that you want to ignore gradlew.bat. Commit the changes.
  3. Push the changes.

Now you can restore / undelete file gradlew.bat.

If everything was correct you should not see any new changes once you call git status.

Related