No, GIT does not do magic . If you did not make or did not make your changes, they disappeared. You can see the deletions, but you can only return them to the last state that you told GIT to remember it for you.
You must explicitly specify GIT to remember your changes by staging and making.
So, if you have a .txt file in your repository with content:
int main(argc[] args){ System.out.println("example"); }
This is your last change that has been made or delivered.
Now you are editing file.txt to contain something like:
int main(argc[] args){ System.out.println("example"); System.out.println("Hey I can print more lines"); }
You save your file, close the editor, do nothing with GIT and do rm -r Now there is a file, and GIT has a link to the file and that it was deleted, but the contents of this file in GIT only:
int main(argc[] args){ System.out.println("example"); }
source share