-1

I performed the above command and seemed to lose some files. I want to know how to undo this command and get my files back.

3
  • 2
    git reset will do the magic, and what do you mean to lose some files?
    – Justin Yu
    Commented Jun 5, 2022 at 16:30
  • You have a combination of two questions, "what does git add * do" and "how do I undo git add", plus a third question: "where did my missing files go". There are two good answers for the first two questions: see git add * (asterisk) vs git add . (period) and How do I undo 'git add' before commit? We can't help with the third question without more details: show the actual commands and the names of the missing files, along with anything else you can provide that will help reproduce the problem.
    – torek
    Commented Jun 5, 2022 at 22:33
  • See also minimal reproducible example and How to Ask.
    – torek
    Commented Jun 5, 2022 at 22:33

1 Answer 1

0

git add * just adds all of the files in the current folder, excluding the ones starting with a dot (.) You shouldn't have lost any files due to that. You can always try git reset and git reset --hard if you haven't changed anything yet.

1
  • 1
    git reset —hard resets the working dir as well as the index to HEAD, meaning all changes would be lost short of extraordinary git gc recovery
    – chipfall
    Commented Jun 6, 2022 at 7:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.