One week ago, my local reporistory has been broken somehow due to some corrupted files. And while trying to fix my repository I have deleted broken files and tried lots of other things that I am not very familiar.
During this period I have also worked on my project without committing.
Can I fix my local repository with replacing .git
folder with the folder that is downloaded from remote.
Note that I don't want to lose works of last week.
答案 0 :(得分:2)
When just some files are broken:
What you can do is get the current status of your repo via
git status
in a console to check which parts of your git repository are broken / has changed. Now you can just checkout the original version via
git checkout <filename>
When something else like the branch is broken: check via
git branch
the current branch. You can checkout the correct version via
git checkout <branch_name>
If you have some other issues: Of course you can checkout the remote repo and copy the files manually into your local copy. But never touch the .git-folders if you do not know what are the meaning of the data stored there. Try to fix your repo with the git-tools makes more sense.