I am new to the GitHub
so, I created a repository and started pushing some CPP code files, then after two or three days I again checked my folders(inside the repo) and found that each folder rarely has one file,but I pushed more than 6 files into each folder (amount of folders 5), is there any solution for this problem?
I pushed all the files using git push -f origin main
, is this creating the problem, or something else please help? and how do I retrieve those files?
CodePudding user response:
- Stop using
-f
(--force
) flag until you really must and know what you're doing:- In most cases it means that something went wrong
- If you're using it often and regularly it means that the workflow is flawed
- It often leads to trouble
- In your repo in github use the commits tab to try to find your missing files:
- If you cannot find your files in the history in GitHub, you can try with
git reflog
on you computer. You can find steps in, for example, Git - README.md Disappeared.