I just made a new repository on github. Starting with a folder full of files, the steps I did were:
git init
git add -A
git remote add origin ...
#Now pull in the first commit that github made
git pull origin master
#Check everything is OK
ls
Eek! All my files have disappeared! What happened? Can I get them back?
The "restore" command helps to unstage or even discard uncommitted local changes. On the one hand, the command can be used to undo the effects of git add and unstage changes you have previously added to the Staging Area.
Never pull before you commit any valid changes. This will wipe off all your changes. To retain your code, you have to commit, then pull, then finally push.
Press Ctrl+z for Undo & CTRL+S for saving the changes. It's worked for me.
For me the following worked:
I hope it helped!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With