I work on a project and I have a problem on my mac. After merging my branch into the main branch by the supervisor I pulled the git project with
§ git pull
After that I did
§ git status
and I recognized that there is a new file named ".DS_Store"
As I read on the internet to delete this file I used this command:
§ find . name '.DS_Store' -type f -delete
but unfortunately, all files in my git directory are deleted !!!!
if I type
§ ls -a
I got only the ".git" file!
Now, if I type
§ git status
I got a list of random files from random locations on my computer as Change to be committed and another list as Change not staged for commit and a list as Untracked files
Please help I have to get rid of this problem!
CodePudding user response:
I see 3 mistakes.
№1: Omitted important dash: name
must be -name
. The entire command must be
find . -name .DS_Store -type f -delete
№2: You haven't debugged a dangerous (because of -delete
) command. You must have run
find . -name .DS_Store -type f
before running it with -delete
.
№3: You don't have a local backup. You should. Make regular backups. I do small backups to my home server 3-5 times a day while I'm working; I do a full backup every Friday evening; I store full backups at the home server and remote servers at different parts of the world; I copy backups to USB disks (hard disks and SSDs) every few months.
Your current best course of action is to clone anew from the remote repository. If you don't remember the URL find it out or ask your teammates.
CodePudding user response:
As you have pulled your git repo from the server, then you should have actual repository on the server. So just delete your current local repository, and pull it again from remote server.
CodePudding user response:
If you still have the .git file then do yourself a huge favor and run
git reflog
That should give you the list of previous commands that where executed. This will include a sha near the commands similar to a git log
Start by iterating down that list until you get to a "fixed repository"
If this doesn't help then it you may have to re clone the git repo and start over unfortunately.