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.
1 Answer
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.
-
1git 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– chipfallCommented Jun 6, 2022 at 7:52
git reset
will do the magic, and what do you mean to lose some files?git add *
do" and "how do I undogit 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.