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.
Asked
Active
Viewed 166 times
-1
-
2`git reset` will do the magic, and what do you mean to lose some files? – Justin Yu Jun 05 '22 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)](https://stackoverflow.com/q/26042390/1256452) and [How do I undo 'git add' before commit?](https://stackoverflow.com/q/348170/1256452) 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 Jun 05 '22 at 22:33
-
See also [mre] and [ask]. – torek Jun 05 '22 at 22:33
1 Answers
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.

VictoriaStudios
- 135
- 1
- 9
-
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 – chipfall Jun 06 '22 at 07:52